* [PATCH] clk: st: clkgen-pll: Fix a memory leak in clkgen_odf_register()
@ 2026-01-15 4:55 Haoxiang Li
2026-01-15 12:01 ` Brian Masney
2026-01-15 13:03 ` Markus Elfring
0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2026-01-15 4:55 UTC (permalink / raw)
To: mturquette, sboyd, bmasney, mturquette, pankaj.dev,
gabriel.fernandez
Cc: linux-clk, linux-kernel, Haoxiang Li, stable
If clk_register_composite() fails, call kfree() to release
div and gate.
Fixes: b9b8e614b580 ("clk: st: Support for PLLs inside ClockGenA(s)")
Cc: stable@vger.kernel.org
Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
drivers/clk/st/clkgen-pll.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/clk/st/clkgen-pll.c b/drivers/clk/st/clkgen-pll.c
index c258ff87a171..a7d605b52cf3 100644
--- a/drivers/clk/st/clkgen-pll.c
+++ b/drivers/clk/st/clkgen-pll.c
@@ -742,8 +742,11 @@ static struct clk * __init clkgen_odf_register(const char *parent_name,
&div->hw, &clk_divider_ops,
&gate->hw, &clk_gate_ops,
flags);
- if (IS_ERR(clk))
+ if (IS_ERR(clk)) {
+ kfree(div);
+ kfree(gate);
return clk;
+ }
pr_debug("%s: parent %s rate %lu\n",
__clk_get_name(clk),
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread* Re: [PATCH] clk: st: clkgen-pll: Fix a memory leak in clkgen_odf_register()
2026-01-15 4:55 [PATCH] clk: st: clkgen-pll: Fix a memory leak in clkgen_odf_register() Haoxiang Li
@ 2026-01-15 12:01 ` Brian Masney
2026-01-15 13:03 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Brian Masney @ 2026-01-15 12:01 UTC (permalink / raw)
To: Haoxiang Li
Cc: mturquette, sboyd, mturquette, pankaj.dev, gabriel.fernandez,
linux-clk, linux-kernel, stable
On Thu, Jan 15, 2026 at 12:55:24PM +0800, Haoxiang Li wrote:
> If clk_register_composite() fails, call kfree() to release
> div and gate.
>
> Fixes: b9b8e614b580 ("clk: st: Support for PLLs inside ClockGenA(s)")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Brian Masney <bmasney@redhat.com>
This patch looks good, however this patch belongs in a series with
your other work to clkgen-pll. I'm going to leave some comments on your
other patch that you posted to this driver.
Brian
^ permalink raw reply [flat|nested] 3+ messages in thread* Re: [PATCH] clk: st: clkgen-pll: Fix a memory leak in clkgen_odf_register()
2026-01-15 4:55 [PATCH] clk: st: clkgen-pll: Fix a memory leak in clkgen_odf_register() Haoxiang Li
2026-01-15 12:01 ` Brian Masney
@ 2026-01-15 13:03 ` Markus Elfring
1 sibling, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2026-01-15 13:03 UTC (permalink / raw)
To: Haoxiang Li, linux-clk, Brian Masney, Gabriel Fernandez,
Michael Turquette, Pankaj Dev, Stephen Boyd
Cc: stable, LKML, Mike Turquette
> If clk_register_composite() fails, call kfree() to release
> div and gate.
You may put such information also into a single text line.
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.19-rc5#n659
How do you think about to avoid a bit of duplicate source code here?
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/coding-style.rst?h=v6.19-rc5#n526
Regards,
Markus
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-01-15 13:03 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-01-15 4:55 [PATCH] clk: st: clkgen-pll: Fix a memory leak in clkgen_odf_register() Haoxiang Li
2026-01-15 12:01 ` Brian Masney
2026-01-15 13:03 ` Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox