The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: Yixun Lan <dlan@gentoo.org>
To: Hendrik Hamerlinck <hendrik.hamerlinck@hammernet.be>
Cc: sboyd@kernel.org, skhan@linuxfoundation.org,
	linux-kernel-mentees@lists.linux.dev, linux-clk@vger.kernel.org,
	linux-riscv@lists.infradead.org, spacemit@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] clk: spacemit: fix resource leak in spacemit_ccu_reset_register
Date: Wed, 23 Jul 2025 20:54:16 +0800	[thread overview]
Message-ID: <20250723125416-GYA738759@gentoo> (raw)
In-Reply-To: <20250723124020.60897-1-hendrik.hamerlinck@hammernet.be>

Hi Hendrik, 

On 14:40 Wed 23 Jul     , Hendrik Hamerlinck wrote:
> The function spacemit_ccu_reset_register() allocates memory for an
> auxiliary device. If auxiliary_device_add() fails, it skips cleanup of
> these resources, resulting in leaks.
> 
> Fix this by using the appropriate error handling path.
> 
> Signed-off-by: Hendrik Hamerlinck <hendrik.hamerlinck@hammernet.be>
> Fixes: 988543522ebd ("clk: spacemit: set up reset auxiliary devices")
Can you put Fixes tag before SoB? I'd suggest to follow tip tree's docs

https://docs.kernel.org/process/maintainer-tip.html
4.2.6. Ordering of commit tags

otherwise, looks good

Reviewed-by: Yixun Lan <dlan@gentoo.org>

> ---
>  drivers/clk/spacemit/ccu-k1.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/clk/spacemit/ccu-k1.c b/drivers/clk/spacemit/ccu-k1.c
> index 65e6de030717..5bb85e32c6cf 100644
> --- a/drivers/clk/spacemit/ccu-k1.c
> +++ b/drivers/clk/spacemit/ccu-k1.c
> @@ -1059,7 +1059,7 @@ static int spacemit_ccu_reset_register(struct device *dev,
>  	ret = auxiliary_device_add(adev);
>  	if (ret) {
>  		auxiliary_device_uninit(adev);
> -		return ret;
> +		goto err_free_aux_id;
>  	}
>  
>  	return devm_add_action_or_reset(dev, spacemit_adev_unregister, adev);
> -- 
> 2.43.0
> 

-- 
Yixun Lan (dlan)

  reply	other threads:[~2025-07-23 12:54 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-23 12:40 [PATCH] clk: spacemit: fix resource leak in spacemit_ccu_reset_register Hendrik Hamerlinck
2025-07-23 12:54 ` Yixun Lan [this message]
2025-07-23 13:10   ` Hendrik Hamerlinck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20250723125416-GYA738759@gentoo \
    --to=dlan@gentoo.org \
    --cc=hendrik.hamerlinck@hammernet.be \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=sboyd@kernel.org \
    --cc=skhan@linuxfoundation.org \
    --cc=spacemit@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox