Skip to content

Commit c8dc236

Browse files
Zihuan Zhangvireshk
authored andcommitted
cpufreq: CPPC: 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 eaa9c1f commit c8dc236

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/cpufreq/cppc_cpufreq.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -722,8 +722,8 @@ static int cppc_get_perf_ctrs_sample(int cpu,
722722

723723
static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
724724
{
725+
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
725726
struct cppc_perf_fb_ctrs fb_ctrs_t0 = {0}, fb_ctrs_t1 = {0};
726-
struct cpufreq_policy *policy = cpufreq_cpu_get(cpu);
727727
struct cppc_cpudata *cpu_data;
728728
u64 delivered_perf;
729729
int ret;
@@ -733,8 +733,6 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
733733

734734
cpu_data = policy->driver_data;
735735

736-
cpufreq_cpu_put(policy);
737-
738736
ret = cppc_get_perf_ctrs_sample(cpu, &fb_ctrs_t0, &fb_ctrs_t1);
739737
if (ret) {
740738
if (ret == -EFAULT)

0 commit comments

Comments
 (0)