summaryrefslogtreecommitdiffstats
path: root/drivers/powercap
diff options
context:
space:
mode:
authorDaniel Lezcano <daniel.lezcano@linaro.org>2021-11-08 07:23:44 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2021-11-10 21:18:14 +0100
commit4d1cd1443db3d5605ebcde8672869b1944ade92d (patch)
treecf220fbc53828d88e9596e3cdbe01f28e9e69a52 /drivers/powercap
parent881007522c8fcc3785c75432dbb149ca1b78e106 (diff)
downloadlinux-4d1cd1443db3d5605ebcde8672869b1944ade92d.tar.gz
linux-4d1cd1443db3d5605ebcde8672869b1944ade92d.tar.bz2
linux-4d1cd1443db3d5605ebcde8672869b1944ade92d.zip
powercap: DTPM: Fix suspend failure and kernel warning
When the ENERGY_MODEL and DTPM_CPU are enabled but actually without any energy model, at cpu hotplug time, the dead cpuhp callback fails leading to the warning. Actually, the check could be simplified and we only do an action if the dtpm cpu is enabled, otherwise we bail out without error. Fixes: 7a89d7eacf8e ("powercap/drivers/dtpm: Simplify the dtpm table") Reported-by: Kenneth R. Crudup <kenny@panix.com> Tested-by: Kenneth R. Crudup <kenny@panix.com> Reported-by: kernel test robot <oliver.sang@intel.com> Signed-off-by: Daniel Lezcano <daniel.lezcano@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/powercap')
-rw-r--r--drivers/powercap/dtpm_cpu.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c
index 44faa3a74db6..b740866b228d 100644
--- a/drivers/powercap/dtpm_cpu.c
+++ b/drivers/powercap/dtpm_cpu.c
@@ -166,16 +166,13 @@ static struct dtpm_ops dtpm_ops = {
static int cpuhp_dtpm_cpu_offline(unsigned int cpu)
{
- struct em_perf_domain *pd;
struct dtpm_cpu *dtpm_cpu;
- pd = em_cpu_get(cpu);
- if (!pd)
- return -EINVAL;
-
dtpm_cpu = per_cpu(dtpm_per_cpu, cpu);
+ if (dtpm_cpu)
+ dtpm_update_power(&dtpm_cpu->dtpm);
- return dtpm_update_power(&dtpm_cpu->dtpm);
+ return 0;
}
static int cpuhp_dtpm_cpu_online(unsigned int cpu)