Power management fix for 6.7-rc5

Fix cpufreq reference counting in the DTPM (dynamic thermal and
 power management) power capping framework (Lukasz Luba).
 -----BEGIN PGP SIGNATURE-----
 
 iQJGBAABCAAwFiEE4fcc61cGeeHD/fCwgsRv/nhiVHEFAmVzVpgSHHJqd0Byand5
 c29ja2kubmV0AAoJEILEb/54YlRxVr4P/j2SMo9M5tA39cHJ3nUWXBV23pWXQW/N
 2Gl1oFr6UAHM3sbIAN6MGGGFAPjIxdLisUMDmPsIc1HkLHBV6aG5vOoxvUP9XCAK
 je+kWIAKsIMaf/l3kfD3OdDda3RQlbcTbVyP8vKxcYWyLe1lAO7ddYuvsXuN9gCb
 t+KoWjN5DSYbS+0reIsBGjYQRA6Asf6mciAdvbFkZwQkot/E9jxxH927IN69X2JJ
 dRG6NsfFbX25Xb1i3a+uNCPrc7NeNYn1NHw2QfDEgGxM0sxBhamTJNNOePZwEx50
 4mM8wvtshV9/rSGlXZBpKm0WaDB1exoE9ot9ZOjpeRiBnoNf1adTtsb0EHOA7V8Y
 nRfB5hS4VfuOVuED9ytwAPcxb3s3VKJmmMb2xquODXRZVELIvtYvRia9Fnp3HP98
 J/lUBmzVe3/ieBoUHPznNIinGqHuXMIRyNejybnwVXGf8wD2Te4tRU9DNeUgHkPJ
 yQFQAURNwZxsCAYOv3DnA8eUjDbPXYrBlHSMP05BNUXBe6qmhf1kMJAEW/zz7x1h
 lJ4mNBGVzfSBlUoD3uuf4+qb1VgseqN1VqgimbWahZqErAhToh0aRsfe8cs/7cFq
 86qifoXfFYPUt2pJVF3P2DWPLZKU3HjpqQUrICQx5zc+EkDP9p9sdOvcnidC/UdV
 b/C3KOe1EvfZ
 =slx+
 -----END PGP SIGNATURE-----

Merge tag 'pm-6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull power management fix from Rafael Wysocki:
 "Fix cpufreq reference counting in the DTPM (dynamic thermal and power
  management) power capping framework (Lukasz Luba)"

* tag 'pm-6.7-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm:
  powercap: DTPM: Fix missing cpufreq_cpu_put() calls
This commit is contained in:
Linus Torvalds 2023-12-08 11:57:55 -08:00
commit 081ed90a8c

View File

@ -140,6 +140,8 @@ static void pd_release(struct dtpm *dtpm)
if (policy) {
for_each_cpu(dtpm_cpu->cpu, policy->related_cpus)
per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) = NULL;
cpufreq_cpu_put(policy);
}
kfree(dtpm_cpu);
@ -191,12 +193,16 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
return 0;
pd = em_cpu_get(cpu);
if (!pd || em_is_artificial(pd))
return -EINVAL;
if (!pd || em_is_artificial(pd)) {
ret = -EINVAL;
goto release_policy;
}
dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL);
if (!dtpm_cpu)
return -ENOMEM;
if (!dtpm_cpu) {
ret = -ENOMEM;
goto release_policy;
}
dtpm_init(&dtpm_cpu->dtpm, &dtpm_ops);
dtpm_cpu->cpu = cpu;
@ -216,6 +222,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
if (ret)
goto out_dtpm_unregister;
cpufreq_cpu_put(policy);
return 0;
out_dtpm_unregister:
@ -227,6 +234,8 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
per_cpu(dtpm_per_cpu, cpu) = NULL;
kfree(dtpm_cpu);
release_policy:
cpufreq_cpu_put(policy);
return ret;
}