From: Miaoqian Lin <linmq006@gmail.com>
To: Stefan Agner <stefan@agner.ch>, Alison Wang <alison.wang@nxp.com>,
Maarten Lankhorst <maarten.lankhorst@linux.intel.com>,
Maxime Ripard <mripard@kernel.org>,
Thomas Zimmermann <tzimmermann@suse.de>,
David Airlie <airlied@gmail.com>, Simona Vetter <simona@ffwll.ch>,
Rob Herring <robh@kernel.org>,
dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org
Cc: linmq006@gmail.com, stable@vger.kernel.org
Subject: [PATCH] drm/fsl-dcu: fix clock reference leak in fsl_tcon_init error path
Date: Fri, 19 Dec 2025 19:20:35 +0400 [thread overview]
Message-ID: <20251219152036.2958051-1-linmq006@gmail.com> (raw)
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
reply other threads:[~2025-12-19 15:20 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20251219152036.2958051-1-linmq006@gmail.com \
--to=linmq006@gmail.com \
--cc=airlied@gmail.com \
--cc=alison.wang@nxp.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-kernel@vger.kernel.org \
--cc=maarten.lankhorst@linux.intel.com \
--cc=mripard@kernel.org \
--cc=robh@kernel.org \
--cc=simona@ffwll.ch \
--cc=stable@vger.kernel.org \
--cc=stefan@agner.ch \
--cc=tzimmermann@suse.de \
/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®