]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: CPPC: Use scope-based cleanup helper
authorZihuan Zhang <zhangzihuan@kylinos.cn>
Wed, 27 Aug 2025 02:31:49 +0000 (10:31 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Fri, 29 Aug 2025 06:03:57 +0000 (11:33 +0530)
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@kylinos.cn>
[ Viresh: Minor changes ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/cppc_cpufreq.c

index ecbeb12f46e64ae82e9e8b8f6faf7eb89273fc99..12de0ac7bbaff09a37f79e4938870206b0b3bdd2 100644 (file)
@@ -722,8 +722,8 @@ static int cppc_get_perf_ctrs_sample(int cpu,
 
 static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
 {
+       struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
        struct cppc_perf_fb_ctrs fb_ctrs_t0 = {0}, fb_ctrs_t1 = {0};
-       struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
        struct cppc_cpudata *cpu_data;
        u64 delivered_perf;
        int ret;
@@ -733,8 +733,6 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
 
        cpu_data = policy->driver_data;
 
-       cpufreq_cpu_put(policy);
-
        ret = cppc_get_perf_ctrs_sample(cpu, &fb_ctrs_t0, &fb_ctrs_t1);
        if (ret) {
                if (ret == -EFAULT)