From: blaze <1466528493@qq.com>
To: jcmvbkbc@gmail.com, chris@zankel.net
Cc: linux-kernel@vger.kernel.org, 赵宇 <1466528493@qq.com>
Subject: [PATCH] xtensa: time: Fix clk reference leak in calibrate_ccount()
Date: Thu, 10 Sep 2026 13:07:07 +0800 [thread overview]
Message-ID: <tencent_7AF43562265F45B58A25576CAFCE66967708@qq.com> (raw)
From: 赵宇 <1466528493@qq.com>
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.
Signed-off-by: 赵宇 <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 09fda6a..bccc0e9 100644
--- a/arch/xtensa/kernel/time.c
+++ b/arch/xtensa/kernel/time.c
@@ -152,6 +152,7 @@ static void __init calibrate_ccount(void)
of_node_put(cpu);
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.53.0.windows.1
next reply other threads:[~2026-09-10 5:08 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-10 5:07 blaze [this message]
2026-09-10 10:49 ` Max Filippov
-- strict thread matches above, loose matches on Subject: below --
2026-09-09 4:43 blaze
2026-09-09 15:39 ` 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_7AF43562265F45B58A25576CAFCE66967708@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®