cpufreq: cppc: Fix invalid return value in .get() callback
PATCH 1/1 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 <[email protected]>
Cc "Rafael J. Wysocki" <[email protected]>
Cc Viresh Kumar <[email protected]>
--- drivers/cpufreq/cppc_cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cppc_cpufreq.c +1 -1
@@ -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;
Signature · 1 line
2.39.2
Quoted 18 lines · Marc Zyngier
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 <[email protected]>Cc "Rafael J. Wysocki" <[email protected]>Cc Viresh Kumar <[email protected]>--- drivers/cpufreq/cppc_cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/cppc_cpufreq.c +0
-0
drivers/cpufreq/cppc_cpufreq.c static unsigned int cppc_cpufreq_get_rate(unsigned int cpu) · line 753
Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c +1
-1@@ -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;
Reviewed-by Lifeng Zheng <[email protected]>
Quoted 8 lines · zhenglifeng (A)
Quoted 7 lines · Marc Zyngier
drivers/cpufreq/cppc_cpufreq.c +0
-0@@ -747,7 +747,7 @@ static unsigned int cppc_cpufreq_get_rate(unsigned int cpu)int ret;
Quoted 8 lines
drivers/cpufreq/cppc_cpufreq.c static unsigned int cppc_cpufreq_get_rate(unsigned int cpu) · line 753
Quoted 6 lines
drivers/cpufreq/cppc_cpufreq.c +1
-1if (!policy) -return -ENODEV ; +return 0 ; cpu_data = policy->driver_data;Reviewed-by Lifeng Zheng <[email protected]>
Applied. Thanks.
Signature · 1 line
viresh