]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
cpufreq: cppc: Fix invalid return value in .get() callback
authorMarc Zyngier <maz@kernel.org>
Sun, 13 Apr 2025 10:11:42 +0000 (11:11 +0100)
committerViresh Kumar <viresh.kumar@linaro.org>
Wed, 16 Apr 2025 08:07:44 +0000 (13:37 +0530)
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>
drivers/cpufreq/cppc_cpufreq.c

index b3d74f9adcf0bc6e1509a4f973962b11a76f80a4..cb93f00bafdbaf25d08bd2bcaf3ef8f82141198e 100644 (file)
@@ -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;