powercap: DTPM: Check for Energy Model type
authorLukasz Luba <lukasz.luba@arm.com>
Mon, 21 Mar 2022 09:57:29 +0000 (09:57 +0000)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Wed, 13 Apr 2022 14:26:18 +0000 (16:26 +0200)
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 <lukasz.luba@arm.com>
Reviewed-by: Ionela Voinescu <ionela.voinescu@arm.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/powercap/dtpm_cpu.c

index bca2f91..f5eced0 100644 (file)
@@ -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);