mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Patrice CHOTARD <patrice.chotard@foss.st.com>
To: Xiu Jianfeng <xiujianfeng@huawei.com>, <mturquette@baylibre.com>,
	<sboyd@kernel.org>, <windhl@126.com>, <avolmat@me.com>
Cc: <linux-clk@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup()
Date: Tue, 22 Nov 2022 17:42:39 +0100	[thread overview]
Message-ID: <e83b6f9a-9144-130e-aebb-17529d3d4d64@foss.st.com> (raw)
In-Reply-To: <20221122133614.184910-1-xiujianfeng@huawei.com>

Hi Xiu

On 11/22/22 14:36, Xiu Jianfeng wrote:
> If st_clk_register_quadfs_pll() fails, @lock should be freed before goto
> @err_exit, otherwise will cause meory leak issue, fix it.
> 
> Signed-off-by: Xiu Jianfeng <xiujianfeng@huawei.com>
> ---
>  drivers/clk/st/clkgen-fsyn.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/clk/st/clkgen-fsyn.c b/drivers/clk/st/clkgen-fsyn.c
> index d820292a381d..40df1db102a7 100644
> --- a/drivers/clk/st/clkgen-fsyn.c
> +++ b/drivers/clk/st/clkgen-fsyn.c
> @@ -1020,9 +1020,10 @@ static void __init st_of_quadfs_setup(struct device_node *np,
>  
>  	clk = st_clk_register_quadfs_pll(pll_name, clk_parent_name, datac->data,
>  			reg, lock);
> -	if (IS_ERR(clk))
> +	if (IS_ERR(clk)) {
> +		kfree(lock);
>  		goto err_exit;
> -	else
> +	} else
>  		pr_debug("%s: parent %s rate %u\n",
>  			__clk_get_name(clk),
>  			__clk_get_name(clk_get_parent(clk)),

Reviewed-by: Patrice Chotard <patrice.chotard@foss.st.com>

Thanks
Patrice

  reply	other threads:[~2022-11-22 16:43 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 13:36 Xiu Jianfeng
2022-11-22 16:42 ` Patrice CHOTARD [this message]
2022-12-08  2:27 ` Stephen Boyd

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=e83b6f9a-9144-130e-aebb-17529d3d4d64@foss.st.com \
    --to=patrice.chotard@foss.st.com \
    --cc=avolmat@me.com \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mturquette@baylibre.com \
    --cc=sboyd@kernel.org \
    --cc=windhl@126.com \
    --cc=xiujianfeng@huawei.com \
    /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

all inboxes | Powered by JetHome®