summaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorJinjie Ruan <ruanjinjie@huawei.com>2024-11-07 19:38:41 +0800
committerViresh Kumar <viresh.kumar@linaro.org>2024-11-11 09:45:17 +0530
commit172bf5ed04cb6c9e66d58de003938ed5c8756570 (patch)
tree6cc0d6fc94de91e7e016284e10c992afbe1a7981 /drivers/cpufreq
parentb51eb0874d8170028434fbd259e80b78ed9b8eca (diff)
downloadlinux-172bf5ed04cb6c9e66d58de003938ed5c8756570.tar.gz
linux-172bf5ed04cb6c9e66d58de003938ed5c8756570.tar.bz2
linux-172bf5ed04cb6c9e66d58de003938ed5c8756570.zip
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: stable@vger.kernel.org Fixes: 4855e26bcf4d ("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>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/mediatek-cpufreq-hw.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cpufreq/mediatek-cpufreq-hw.c b/drivers/cpufreq/mediatek-cpufreq-hw.c
index 8925e096d5b9..aeb5e6304542 100644
--- a/drivers/cpufreq/mediatek-cpufreq-hw.c
+++ b/drivers/cpufreq/mediatek-cpufreq-hw.c
@@ -62,7 +62,7 @@ mtk_cpufreq_get_cpu_power(struct device *cpu_dev, unsigned long *uW,
policy = cpufreq_cpu_get_raw(cpu_dev->id);
if (!policy)
- return 0;
+ return -EINVAL;
data = policy->driver_data;