[PATCH] cpufreq: pxa: Release the core clock reference on failure and exit
From: Wentao Liang
Date: Tue Nov 03 2026 - 01:29:54 EST
pxa_cpu_init() obtains a reference to the core clock with clk_get_sys(),
but neither an unsupported CPU nor a failed cpufreq_register_driver()
releases it. The module exit path also leaves the reference held after
unregistering the cpufreq driver.
Drop the clock reference when initialization fails and after unregistering
the driver on exit.
Fixes: d9278077385f ("cpufreq: pxa: convert to clock API")
Cc: stable@xxxxxxxxxxxxxxx
Assisted-by: DeepSeek-V4.1-Flash and OpenAI Codex
Signed-off-by: Wentao Liang <vulab@xxxxxxxxxxx>
---
drivers/cpufreq/pxa2xx-cpufreq.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/cpufreq/pxa2xx-cpufreq.c b/drivers/cpufreq/pxa2xx-cpufreq.c
index ed1ae061a687..83cd5a5ec7ea 100644
--- a/drivers/cpufreq/pxa2xx-cpufreq.c
+++ b/drivers/cpufreq/pxa2xx-cpufreq.c
@@ -305,12 +305,15 @@ static int __init pxa_cpu_init(void)
if (cpu_is_pxa25x() || cpu_is_pxa27x())
ret = cpufreq_register_driver(&pxa_cpufreq_driver);
+ if (ret)
+ clk_put(pxa_cpufreq_data.clk_core);
return ret;
}
static void __exit pxa_cpu_exit(void)
{
cpufreq_unregister_driver(&pxa_cpufreq_driver);
+ clk_put(pxa_cpufreq_data.clk_core);
}
--
2.34.1