]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: brcmstb-avs: Use scope-based cleanup helper
authorZihuan Zhang <zhangzihuan@kylinos.cn>
Wed, 27 Aug 2025 02:31:48 +0000 (10:31 +0800)
committerViresh Kumar <viresh.kumar@linaro.org>
Fri, 29 Aug 2025 05:58:27 +0000 (11:28 +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 to commit log ]
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/cpufreq/brcmstb-avs-cpufreq.c

index 5940d262374f053604c41a2db6fad1a67db59a82..71450cca8e9f45bcc97b4f3e2d8095fb787d8ce2 100644 (file)
@@ -480,7 +480,7 @@ static bool brcm_avs_is_firmware_loaded(struct private_data *priv)
 
 static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
 {
-       struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
+       struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
        struct private_data *priv;
 
        if (!policy)
@@ -488,8 +488,6 @@ static unsigned int brcm_avs_cpufreq_get(unsigned int cpu)
 
        priv = policy->driver_data;
 
-       cpufreq_cpu_put(policy);
-
        return brcm_avs_get_frequency(priv->base);
 }