cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power()
commit172bf5ed04upstream. mtk_cpufreq_get_cpu_power() return 0 if the policy is NULL. Then in em_create_perf_table(), the later zero check for power is not invalid as power is uninitialized. As Lukasz suggested, it must return -EINVAL when the 'policy' is not found. So return -EINVAL to fix it. Cc: stable@vger.kernel.org Fixes:4855e26bcf("cpufreq: mediatek-hw: Add support for CPUFREQ HW") Reviewed-by: Lukasz Luba <lukasz.luba@arm.com> Suggested-by: Lukasz Luba <lukasz.luba@arm.com> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
committed by
Greg Kroah-Hartman
parent
e6e42c57ce
commit
bc846c0be8
@@ -60,7 +60,7 @@ mtk_cpufreq_get_cpu_power(unsigned long *mW,
|
||||
|
||||
policy = cpufreq_cpu_get_raw(cpu_dev->id);
|
||||
if (!policy)
|
||||
return 0;
|
||||
return -EINVAL;
|
||||
|
||||
data = policy->driver_data;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user