From: Marc Zyngier Date: Sun, 13 Apr 2025 10:11:42 +0000 (+0100) Subject: cpufreq: cppc: Fix invalid return value in .get() callback X-Git-Tag: v6.15-rc4~20^2^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=2b8e6b58889c672e1ae3601d9b2b070be4dc2fbc;p=thirdparty%2Fkernel%2Flinux.git 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 Cc: "Rafael J. Wysocki" Cc: Viresh Kumar Reviewed-by: Lifeng Zheng Signed-off-by: Viresh Kumar --- diff --git a/drivers/cpufreq/cppc_cpufreq.c b/drivers/cpufreq/cppc_cpufreq.c index b3d74f9adcf0b..cb93f00bafdba 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;