* [PATCH] drm/fsl-dcu: fix clock reference leak in fsl_tcon_init error path
@ 2025-12-19 15:20 Miaoqian Lin
0 siblings, 0 replies; only message in thread
From: Miaoqian Lin @ 2025-12-19 15:20 UTC (permalink / raw)
To: Stefan Agner, Alison Wang, Maarten Lankhorst, Maxime Ripard,
Thomas Zimmermann, David Airlie, Simona Vetter, Rob Herring,
dri-devel, linux-kernel
Cc: linmq006, stable
In fsl_tcon_init(), when of_clk_get_by_name() succeeds but
clk_prepare_enable() fails, the function jumps to err_node_put label
without releasing the clock reference obtained.
This causes a clock reference leak.
Fix by calling clk_put() that properly releases the clock
reference.
Found via static analysis and code review.
Fixes: fb127b7943c9 ("drm/fsl-dcu: add TCON driver")
Cc: stable@vger.kernel.org
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
drivers/gpu/drm/fsl-dcu/fsl_tcon.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
index 49bbd00c77ae..b7ba90814b0e 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_tcon.c
@@ -86,7 +86,7 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev)
ret = clk_prepare_enable(tcon->ipg_clk);
if (ret) {
dev_err(dev, "Couldn't enable the TCON clock\n");
- goto err_node_put;
+ goto err_clk_put;
}
of_node_put(np);
@@ -94,6 +94,8 @@ struct fsl_tcon *fsl_tcon_init(struct device *dev)
return tcon;
+err_clk_put:
+ clk_put(tcon->ipg_clk);
err_node_put:
of_node_put(np);
return NULL;
--
2.25.1
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2025-12-19 15:20 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2025-12-19 15:20 [PATCH] drm/fsl-dcu: fix clock reference leak in fsl_tcon_init error path Miaoqian Lin
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®