public inbox for soc@kernel.org
 help / color / mirror / Atom feed
* [PATCH] clk: spear: fix resource leak in clk_register_vco_pll()
@ 2026-03-25  6:22 Haoxiang Li
  2026-03-25  7:07 ` Viresh Kumar
  2026-04-01 22:10 ` patchwork-bot+linux-soc
  0 siblings, 2 replies; 3+ messages in thread
From: Haoxiang Li @ 2026-03-25  6:22 UTC (permalink / raw)
  To: vireshk, mturquette, sboyd
  Cc: linux-arm-kernel, soc, linux-clk, linux-kernel, Haoxiang Li

Add a goto label in clk_register_vco_pll(), unregister vco_clk
if tpll_clk is failed to be registered.

Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
---
 drivers/clk/spear/clk-vco-pll.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/clk/spear/clk-vco-pll.c b/drivers/clk/spear/clk-vco-pll.c
index 723a6eb67754..ceb82723fa8c 100644
--- a/drivers/clk/spear/clk-vco-pll.c
+++ b/drivers/clk/spear/clk-vco-pll.c
@@ -343,13 +343,15 @@ struct clk *clk_register_vco_pll(const char *vco_name, const char *pll_name,
 
 	tpll_clk = clk_register(NULL, &pll->hw);
 	if (IS_ERR_OR_NULL(tpll_clk))
-		goto free_pll;
+		goto unregister_clk;
 
 	if (pll_clk)
 		*pll_clk = tpll_clk;
 
 	return vco_clk;
 
+unregister_clk:
+	clk_unregister(vco_clk);
 free_pll:
 	kfree(pll);
 free_vco:
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-04-01 22:10 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-25  6:22 [PATCH] clk: spear: fix resource leak in clk_register_vco_pll() Haoxiang Li
2026-03-25  7:07 ` Viresh Kumar
2026-04-01 22:10 ` patchwork-bot+linux-soc

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox