Skip to content

Commit 4aeda90

Browse files
Zihuan Zhangvireshk
authored andcommitted
cpufreq: mediatek: Use scope-based cleanup helper
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>
1 parent 95102e0 commit 4aeda90

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

drivers/cpufreq/mediatek-cpufreq.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -320,7 +320,6 @@ static int mtk_cpufreq_opp_notifier(struct notifier_block *nb,
320320
struct dev_pm_opp *new_opp;
321321
struct mtk_cpu_dvfs_info *info;
322322
unsigned long freq, volt;
323-
struct cpufreq_policy *policy;
324323
int ret = 0;
325324

326325
info = container_of(nb, struct mtk_cpu_dvfs_info, opp_nb);
@@ -353,12 +352,12 @@ static int mtk_cpufreq_opp_notifier(struct notifier_block *nb,
353352
}
354353

355354
dev_pm_opp_put(new_opp);
356-
policy = cpufreq_cpu_get(info->opp_cpu);
357-
if (policy) {
355+
356+
struct cpufreq_policy *policy __free(put_cpufreq_policy)
357+
= cpufreq_cpu_get(info->opp_cpu);
358+
if (policy)
358359
cpufreq_driver_target(policy, freq / 1000,
359360
CPUFREQ_RELATION_L);
360-
cpufreq_cpu_put(policy);
361-
}
362361
}
363362
}
364363

0 commit comments

Comments
 (0)