Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] cpufreq: qoriq: Fix clk reference leak in get_bus_freq()
@ 2026-09-09  4:41 blaze
  2026-09-09 16:22 ` Zhongqiu Han
  0 siblings, 1 reply; 2+ messages in thread
From: blaze @ 2026-09-09  4:41 UTC (permalink / raw)
  To: rafael, viresh.kumar; +Cc: linux-pm, linux-kernel, blaze

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


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-09-09 16:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-09  4:41 [PATCH] cpufreq: qoriq: Fix clk reference leak in get_bus_freq() blaze
2026-09-09 16:22 ` Zhongqiu Han

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox