[PATCH v3 08/12] cpufreq: powerpc: macintosh: Use scope-based cleanup helper
Zihuan Zhang
zhangzihuan at kylinos.cn
Mon Sep 1 18:57:44 AEST 2025
Replace the manual cpufreq_cpu_put() with __free(put_cpufreq_policy)
annotation for policy references. This reduces the risk of reference
counting mistakes and aligns the code with the latest kernel style.
No functional change intended.
Signed-off-by: Zihuan Zhang <zhangzihuan at kylinos.cn>
---
drivers/macintosh/windfarm_cpufreq_clamp.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/drivers/macintosh/windfarm_cpufreq_clamp.c b/drivers/macintosh/windfarm_cpufreq_clamp.c
index 28d18ef22bbb..08558756990b 100644
--- a/drivers/macintosh/windfarm_cpufreq_clamp.c
+++ b/drivers/macintosh/windfarm_cpufreq_clamp.c
@@ -62,12 +62,11 @@ static const struct wf_control_ops clamp_ops = {
static int __init wf_cpufreq_clamp_init(void)
{
- struct cpufreq_policy *policy;
+ struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(0);
struct wf_control *clamp;
struct device *dev;
int ret;
- policy = cpufreq_cpu_get(0);
if (!policy) {
pr_warn("%s: cpufreq policy not found cpu0\n", __func__);
return -EPROBE_DEFER;
@@ -79,8 +78,6 @@ static int __init wf_cpufreq_clamp_init(void)
ret = freq_qos_add_request(&policy->constraints, &qos_req, FREQ_QOS_MAX,
max_freq);
- cpufreq_cpu_put(policy);
-
if (ret < 0) {
pr_err("%s: Failed to add freq constraint (%d)\n", __func__,
ret);
--
2.25.1
More information about the Linuxppc-dev
mailing list