Commit 081ed90a authored by Linus Torvalds's avatar Linus Torvalds

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
parents c3e2f9bd bdefd991
...@@ -140,6 +140,8 @@ static void pd_release(struct dtpm *dtpm) ...@@ -140,6 +140,8 @@ static void pd_release(struct dtpm *dtpm)
if (policy) { if (policy) {
for_each_cpu(dtpm_cpu->cpu, policy->related_cpus) for_each_cpu(dtpm_cpu->cpu, policy->related_cpus)
per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) = NULL; per_cpu(dtpm_per_cpu, dtpm_cpu->cpu) = NULL;
cpufreq_cpu_put(policy);
} }
kfree(dtpm_cpu); kfree(dtpm_cpu);
...@@ -191,12 +193,16 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) ...@@ -191,12 +193,16 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
return 0; return 0;
pd = em_cpu_get(cpu); pd = em_cpu_get(cpu);
if (!pd || em_is_artificial(pd)) if (!pd || em_is_artificial(pd)) {
return -EINVAL; ret = -EINVAL;
goto release_policy;
}
dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL); dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL);
if (!dtpm_cpu) if (!dtpm_cpu) {
return -ENOMEM; ret = -ENOMEM;
goto release_policy;
}
dtpm_init(&dtpm_cpu->dtpm, &dtpm_ops); dtpm_init(&dtpm_cpu->dtpm, &dtpm_ops);
dtpm_cpu->cpu = cpu; dtpm_cpu->cpu = cpu;
...@@ -216,6 +222,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) ...@@ -216,6 +222,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
if (ret) if (ret)
goto out_dtpm_unregister; goto out_dtpm_unregister;
cpufreq_cpu_put(policy);
return 0; return 0;
out_dtpm_unregister: out_dtpm_unregister:
...@@ -227,6 +234,8 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) ...@@ -227,6 +234,8 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent)
per_cpu(dtpm_per_cpu, cpu) = NULL; per_cpu(dtpm_per_cpu, cpu) = NULL;
kfree(dtpm_cpu); kfree(dtpm_cpu);
release_policy:
cpufreq_cpu_put(policy);
return ret; return ret;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment