[PATCH] cpufreq: s5pv210: Release clock references on policy exit
Tian Xuechen
202300460064 at mail.sdu.edu.cn
Thu Dec 3 05:06:50 PST 2026
s5pv210_cpu_init() acquires references to armclk, sclk_dmc0 and
hclk_msys, and releases them if initialization fails. If initialization
succeeds but cpufreq_add_dev_interface() then fails, the core tears down
the policy. The driver has no .exit callback, so the clock references
are left behind.
Add a policy exit callback to release the three clock references in
reverse order when the core tears down the initialized policy.
Fixes: 83efc7432f88 ("ARM: S5PV210: Add support CPUFREQ")
Signed-off-by: Tian Xuechen <202300460064 at mail.sdu.edu.cn>
---
This standalone patch keeps the policy clock cleanup discussed in the
earlier S5PV210/SPEAr series:
https://lore.kernel.org/r/20261130082751.2183908-1-202300460064@mail.sdu.edu.cn
A coding assistant helped extract the clock cleanup from the earlier
patch and draft the commit message.
Cross-compiled the S5PV210 cpufreq object with s5pv210_defconfig,
Clang 21.1.8 and W=1.
drivers/cpufreq/s5pv210-cpufreq.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/cpufreq/s5pv210-cpufreq.c b/drivers/cpufreq/s5pv210-cpufreq.c
index 29b1c5d..9d00c36 100644
--- a/drivers/cpufreq/s5pv210-cpufreq.c
+++ b/drivers/cpufreq/s5pv210-cpufreq.c
@@ -553,6 +553,13 @@ out_dmc0:
return ret;
}
+static void s5pv210_cpu_exit(struct cpufreq_policy *policy)
+{
+ clk_put(dmc1_clk);
+ clk_put(dmc0_clk);
+ clk_put(policy->clk);
+}
+
static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this,
unsigned long event, void *ptr)
{
@@ -579,6 +586,7 @@ static struct cpufreq_driver s5pv210_driver = {
.target_index = s5pv210_target,
.get = cpufreq_generic_get,
.init = s5pv210_cpu_init,
+ .exit = s5pv210_cpu_exit,
.name = "s5pv210",
.suspend = cpufreq_generic_suspend,
.resume = cpufreq_generic_suspend, /* We need to set SLEEP FREQ again */
base-commit: ad6e0770a9243e916ade0207931108e5a2d7f487
More information about the linux-arm-kernel
mailing list