]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
cpufreq: s5pv210: Use scope-based cleanup helper
authorZihuan Zhang <zhangzihuan@kylinos.cn>
Wed, 27 Aug 2025 02:31:54 +0000 (10:31 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Fri, 29 Aug 2025 06:12:24 +0000 (11:42 +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/s5pv210-cpufreq.c

index 76c888ed8d160a7de0f68d14498397b631a07825..4215621deb3fe8566d11029dc6fd6f1d2e191a9c 100644 (file)
@@ -554,17 +554,15 @@ out_dmc0:
 static int s5pv210_cpufreq_reboot_notifier_event(struct notifier_block *this,
                                                 unsigned long event, void *ptr)
 {
+       struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(0);
        int ret;
-       struct cpufreq_policy *policy;
 
-       policy = cpufreq_cpu_get(0);
        if (!policy) {
                pr_debug("cpufreq: get no policy for cpu0\n");
                return NOTIFY_BAD;
        }
 
        ret = cpufreq_driver_target(policy, SLEEP_FREQ, 0);
-       cpufreq_cpu_put(policy);
 
        if (ret < 0)
                return NOTIFY_BAD;