* [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup()
@ 2022-11-22 13:36 Xiu Jianfeng
2022-11-22 16:42 ` Patrice CHOTARD
2022-12-08 2:27 ` Stephen Boyd
0 siblings, 2 replies; 3+ messages in thread
From: Xiu Jianfeng @ 2022-11-22 13:36 UTC (permalink / raw)
To: mturquette, sboyd, windhl, avolmat, patrice.chotard
Cc: linux-clk, linux-kernel
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)),
--
2.17.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup()
2022-11-22 13:36 [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup() Xiu Jianfeng
@ 2022-11-22 16:42 ` Patrice CHOTARD
2022-12-08 2:27 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Patrice CHOTARD @ 2022-11-22 16:42 UTC (permalink / raw)
To: Xiu Jianfeng, mturquette, sboyd, windhl, avolmat; +Cc: linux-clk, linux-kernel
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
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup()
2022-11-22 13:36 [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup() Xiu Jianfeng
2022-11-22 16:42 ` Patrice CHOTARD
@ 2022-12-08 2:27 ` Stephen Boyd
1 sibling, 0 replies; 3+ messages in thread
From: Stephen Boyd @ 2022-12-08 2:27 UTC (permalink / raw)
To: Xiu Jianfeng, avolmat, mturquette, patrice.chotard, windhl
Cc: linux-clk, linux-kernel
Quoting Xiu Jianfeng (2022-11-22 05:36:14)
> 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>
> ---
Applied to clk-next
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-12-08 2:27 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-11-22 13:36 [PATCH] clk: st: Fix memory leak in st_of_quadfs_setup() Xiu Jianfeng
2022-11-22 16:42 ` Patrice CHOTARD
2022-12-08 2:27 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).