Commit 179c0c70 authored by Yaxiong Tian's avatar Yaxiong Tian Committed by Rafael J. Wysocki
Browse files

PM: EM: Fix potential division-by-zero error in em_compute_costs()



When the device is of a non-CPU type, table[i].performance won't be
initialized in the previous em_init_performance(), resulting in division
by zero when calculating costs in em_compute_costs().

Since the 'cost' algorithm is only used for EAS energy efficiency
calculations and is currently not utilized by other device drivers, we
should add the _is_cpu_device(dev) check to prevent this division-by-zero
issue.

Fixes: 1b600da5 ("PM: EM: Optimize em_cpu_energy() and remove division")
Signed-off-by: default avatarYaxiong Tian <tianyaxiong@kylinos.cn>
Reviewed-by: default avatarLukasz Luba <lukasz.luba@arm.com>
Link: https://patch.msgid.link/tencent_7F99ED4767C1AF7889D0D8AD50F34859CE06@qq.com


Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent b4432656
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment