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 <zhangzih...@kylinos.cn>
---
 drivers/cpufreq/powernv-cpufreq.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/cpufreq/powernv-cpufreq.c 
b/drivers/cpufreq/powernv-cpufreq.c
index 7d9a5f656de8..782cf5a482c0 100644
--- a/drivers/cpufreq/powernv-cpufreq.c
+++ b/drivers/cpufreq/powernv-cpufreq.c
@@ -892,15 +892,15 @@ static int powernv_cpufreq_reboot_notifier(struct 
notifier_block *nb,
                                unsigned long action, void *unused)
 {
        int cpu;
-       struct cpufreq_policy *cpu_policy;
 
        rebooting = true;
        for_each_online_cpu(cpu) {
+               struct cpufreq_policy *cpu_policy __free(put_cpufreq_policy);
+
                cpu_policy = cpufreq_cpu_get(cpu);
                if (!cpu_policy)
                        continue;
                powernv_cpufreq_target_index(cpu_policy, get_nominal_index());
-               cpufreq_cpu_put(cpu_policy);
        }
 
        return NOTIFY_DONE;
@@ -913,7 +913,6 @@ static struct notifier_block powernv_cpufreq_reboot_nb = {
 static void powernv_cpufreq_work_fn(struct work_struct *work)
 {
        struct chip *chip = container_of(work, struct chip, throttle);
-       struct cpufreq_policy *policy;
        unsigned int cpu;
        cpumask_t mask;
 
@@ -928,6 +927,7 @@ static void powernv_cpufreq_work_fn(struct work_struct 
*work)
        chip->restore = false;
        for_each_cpu(cpu, &mask) {
                int index;
+               struct cpufreq_policy *policy __free(put_cpufreq_policy);
 
                policy = cpufreq_cpu_get(cpu);
                if (!policy)
@@ -935,7 +935,6 @@ static void powernv_cpufreq_work_fn(struct work_struct 
*work)
                index = cpufreq_table_find_index_c(policy, policy->cur, false);
                powernv_cpufreq_target_index(policy, index);
                cpumask_andnot(&mask, &mask, policy->cpus);
-               cpufreq_cpu_put(policy);
        }
 out:
        cpus_read_unlock();
-- 
2.25.1

Reply via email to