From: Lukasz Luba Date: Mon, 21 Mar 2022 09:57:29 +0000 (+0000) Subject: powercap: DTPM: Check for Energy Model type X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=985a67709a66c456414182ed179544786e00321e;p=linux.git powercap: DTPM: Check for Energy Model type The Energy Model power values might be artificial. In such case it's safe to bail out during the registration, since the PowerCap framework supports only micro-Watts. Signed-off-by: Lukasz Luba Reviewed-by: Ionela Voinescu Signed-off-by: Rafael J. Wysocki --- diff --git a/drivers/powercap/dtpm_cpu.c b/drivers/powercap/dtpm_cpu.c index bca2f912d3496..f5eced0842b36 100644 --- a/drivers/powercap/dtpm_cpu.c +++ b/drivers/powercap/dtpm_cpu.c @@ -211,7 +211,7 @@ static int __dtpm_cpu_setup(int cpu, struct dtpm *parent) return 0; pd = em_cpu_get(cpu); - if (!pd) + if (!pd || em_is_artificial(pd)) return -EINVAL; dtpm_cpu = kzalloc(sizeof(*dtpm_cpu), GFP_KERNEL);