Messages in this thread |  | | Date | Fri, 5 Sep 2025 10:49:52 +0100 | | From | Jonathan Cameron <> | | Subject | Re: [PATCH v4 04/10] cpufreq: powernv: Use scope-based cleanup helper |
| |
On Wed, 3 Sep 2025 21:17:27 +0800 Zihuan Zhang <zhangzihuan@kylinos.cn> wrote:
> 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> This one is a little more weak wrt to justification. Kernel style isn't to use __free() where there isn't a significant benefit.
Up to maintainer of the driver on this one so I'll not offer a tag.
> --- > drivers/cpufreq/powernv-cpufreq.c | 11 +++++------ > 1 file changed, 5 insertions(+), 6 deletions(-) > > diff --git a/drivers/cpufreq/powernv-cpufreq.c b/drivers/cpufreq/powernv-cpufreq.c > index 7d9a5f656de8..811fdbf398fa 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) { > - cpu_policy = cpufreq_cpu_get(cpu); > + struct cpufreq_policy *cpu_policy __free(put_cpufreq_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,14 +927,14 @@ 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) = > + cpufreq_cpu_get(cpu); > > - policy = cpufreq_cpu_get(cpu); > if (!policy) > continue; > 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();
|  |