aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/cpufreq
diff options
context:
space:
mode:
authorMarc Zyngier <maz@kernel.org>2025-04-13 11:11:42 +0100
committerViresh Kumar <viresh.kumar@linaro.org>2025-04-16 13:37:44 +0530
commit2b8e6b58889c672e1ae3601d9b2b070be4dc2fbc (patch)
treea616a6867a71799e8fb01a735316f1b133432e91 /drivers/cpufreq
parentcpufreq: scpi: Fix null-ptr-deref in scpi_cpufreq_get_rate() (diff)
downloadlinux-rng-2b8e6b58889c672e1ae3601d9b2b070be4dc2fbc.tar.xz
linux-rng-2b8e6b58889c672e1ae3601d9b2b070be4dc2fbc.zip
cpufreq: cppc: Fix invalid return value in .get() callback
Returning a negative error code in a function with an unsigned return type is a pretty bad idea. It is probably worse when the justification for the change is "our static analisys tool found it". Fixes: cf7de25878a1 ("cppc_cpufreq: Fix possible null pointer dereference") Signed-off-by: Marc Zyngier <maz@kernel.org> Cc: "Rafael J. Wysocki" <rafael@kernel.org> Cc: Viresh Kumar <viresh.kumar@linaro.org> Reviewed-by: Lifeng Zheng <zhenglifeng1@huawei.com> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Diffstat (limited to 'drivers/cpufreq')
-rw-r--r--drivers/cpufreq/cppc_cpufreq.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c
index b3d74f9adcf0..cb93f00bafdb 100644
--- a/drivers/cpufreq/cppc_cpufreq.c
+++ b/drivers/cpufreq/cppc_cpufreq.c
@@ -747,7 +747,7 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)
int ret;
if (!policy)
- return -ENODEV;
+ return 0;
cpu_data = policy->driver_data;