Skip to content

Commit 7bc0084

Browse files
Zihuan Zhangvireshk
authored andcommitted
cpufreq: tegra186: 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 4aeda90 commit 7bc0084

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

drivers/cpufreq/tegra186-cpufreq.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,21 +103,19 @@ static int tegra186_cpufreq_set_target(struct cpufreq_policy *policy,
103103

104104
static unsigned int tegra186_cpufreq_get(unsigned int cpu)
105105
{
106+
struct cpufreq_policy *policy __free(put_cpufreq_policy) = cpufreq_cpu_get(cpu);
106107
struct tegra186_cpufreq_data *data = cpufreq_get_driver_data();
107108
struct tegra186_cpufreq_cluster *cluster;
108-
struct cpufreq_policy *policy;
109109
unsigned int edvd_offset, cluster_id;
110110
u32 ndiv;
111111

112-
policy = cpufreq_cpu_get(cpu);
113112
if (!policy)
114113
return 0;
115114

116115
edvd_offset = data->cpus[policy->cpu].edvd_offset;
117116
ndiv = readl(data->regs + edvd_offset) & EDVD_CORE_VOLT_FREQ_F_MASK;
118117
cluster_id = data->cpus[policy->cpu].bpmp_cluster_id;
119118
cluster = &data->clusters[cluster_id];
120-
cpufreq_cpu_put(policy);
121119

122120
return (cluster->ref_clk_khz * ndiv) / cluster->div;
123121
}

0 commit comments

Comments
 (0)