From: blaze <1466528493@qq.com>
To: chris@zankel.net, jcmvbkbc@gmail.com
Cc: linux-kernel@vger.kernel.org, blaze <1466528493@qq.com>
Subject: [PATCH] xtensa: time: Fix clk reference leak in calibrate_ccount()
Date: Wed, 9 Sep 2026 12:43:14 +0800 [thread overview]
Message-ID: <tencent_81DAE01221B65767204B64FA5A31B3AF8407@qq.com> (raw)
In calibrate_ccount(), of_clk_get() acquires a reference to the CPU clock,
but clk_put() is never called to release it. The clock reference is used
only to read the frequency via clk_get_rate(), then the function returns
immediately, leaking the reference.
Fix this by calling clk_put(clk) before returning.
Fixes: a1f31a21e0c1 ("xtensa: add clocksource")
Signed-off-by: blaze <1466528493@qq.com>
---
arch/xtensa/kernel/time.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/arch/xtensa/kernel/time.c b/arch/xtensa/kernel/time.c
index 0000000..1111111 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -152,6 +152,7 @@ static void __init calibrate_ccount(void)
if (!IS_ERR(clk)) {
ccount_freq = clk_get_rate(clk);
+ clk_put(clk);
return;
} else {
pr_warn("%s: CPU input clock not found\n",
--
2.43.0
next reply other threads:[~2026-09-09 4:43 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 4:43 blaze [this message]
2026-09-09 15:39 ` Max Filippov
2026-09-10 5:07 blaze
2026-09-10 10:49 ` Max Filippov
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=tencent_81DAE01221B65767204B64FA5A31B3AF8407@qq.com \
--to=1466528493@qq.com \
--cc=chris@zankel.net \
--cc=jcmvbkbc@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/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®