Skip to content

Commit 172bf5e

Browse files
Jinjie Ruanvireshk
authored andcommitted
cpufreq: mediatek-hw: Fix wrong return value in mtk_cpufreq_get_cpu_power()
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: [email protected] Fixes: 4855e26 ("cpufreq: mediatek-hw: Add support for CPUFREQ HW") Reviewed-by: Lukasz Luba <[email protected]> Suggested-by: Lukasz Luba <[email protected]> Signed-off-by: Jinjie Ruan <[email protected]> Signed-off-by: Viresh Kumar <[email protected]>
1 parent b51eb08 commit 172bf5e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/cpufreq/mediatek-cpufreq-hw.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ mtk_cpufreq_get_cpu_power(struct device *cpu_dev, unsigned long *uW,
6262

6363
policy = cpufreq_cpu_get_raw(cpu_dev->id);
6464
if (!policy)
65-
return 0;
65+
return -EINVAL;
6666

6767
data = policy->driver_data;
6868

0 commit comments

Comments
 (0)