From: blaze <1466528493@qq.com>
To: rafael@kernel.org, viresh.kumar@linaro.org
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
blaze <1466528493@qq.com>
Subject: [PATCH] cpufreq: qoriq: Fix clk reference leak in get_bus_freq()
Date: Wed, 9 Sep 2026 12:41:22 +0800 [thread overview]
Message-ID: <tencent_60DAC4127B362B6743CB0BFA2C31982FD807@qq.com> (raw)
clk_get() acquires a reference to the clock which must be released with
clk_put() when no longer needed. In get_bus_freq(), the clock reference
obtained by clk_get() is used only to read the frequency via
clk_get_rate(), but clk_put() is never called, causing a clock reference
count leak on every invocation.
Fix this by calling clk_put() before returning the frequency.
Fixes: 1b6f255990ae ("cpufreq: qoriq: Enhance the support of clock from DTS")
Signed-off-by: blaze <1466528493@qq.com>
---
drivers/cpufreq/qoriq-cpufreq.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/cpufreq/qoriq-cpufreq.c b/drivers/cpufreq/qoriq-cpufreq.c
index 0000000..1111111 100644
--- a/drivers/cpufreq/qoriq-cpufreq.c
+++ b/drivers/cpufreq/qoriq-cpufreq.c
@@ -62,7 +62,9 @@ static u32 get_bus_freq(void)
__func__, PTR_ERR(pltclk));
return PTR_ERR(pltclk);
}
- return clk_get_rate(pltclk);
+ sysfreq = clk_get_rate(pltclk);
+ clk_put(pltclk);
+ return sysfreq;
}
static struct qoriq_cpu_data *qoriq_cpu_data;
--
2.43.0
next reply other threads:[~2026-09-09 4:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-09 4:41 blaze [this message]
2026-09-09 16:22 ` [PATCH] cpufreq: qoriq: Fix clk reference leak in get_bus_freq() Zhongqiu Han
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_60DAC4127B362B6743CB0BFA2C31982FD807@qq.com \
--to=1466528493@qq.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=rafael@kernel.org \
--cc=viresh.kumar@linaro.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;
as well as URLs for NNTP newsgroup(s).