cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq
PATCH 1/1 cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq
When converting to a shared library in ac5a181d065d ("cpupower: Add cpuidle parts into library"), cpu_freq_cpu_exists was converted to cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and -ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success. Check for the correct return value in cpufreq-set.
See https://bugzilla.redhat.com/show_bug.cgi?id=1374212
--- tools/power/cpupower/utils/cpufreq-set.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
tools/power/cpupower/utils/cpufreq-set.c +2 -2
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)struct cpufreq_affected_cpus *cpus;if (!bitmask_isbitset (cpus_chosen, cpu) || -cpupower_is_cpu_online (cpu)) +cpupower_is_cpu_online (cpu) !=1 )continue ; cpus =cpufreq_get_related_cpus (cpu);
@@ -316,7 +316,7 @@ int cmd_freq_set(int argc, char **argv) cpu <= bitmask_last(cpus_chosen); cpu++) {if (!bitmask_isbitset (cpus_chosen, cpu) || -cpupower_is_cpu_online (cpu)) +cpupower_is_cpu_online (cpu) !=1 )continue ;if (cpupower_is_cpu_online (cpu) !=1 )
Signature · 1 line
2.10.0
Hi,
Quoted 29 lines · Laura Abbott
When converting to a shared library in
ac5a181d065d("cpupower: Add cpuidle parts into library"),cpu_freq_cpu_existswas converted tocpupower_is_cpu_online.cpu_req_cpu_existsreturned 0 on success and-ENOSYSon failure whereascpupower_is_cpu_onlinereturns 1 on success. Check for the correct return value in cpufreq-set.See https://bugzilla.redhat.com/show_bug.cgi?id=1374212
Fixes ac5a181d065d ("cpupower: Add cpuidle parts into library")Reported-by Julian Seward <[email protected]>Signed-off-by Laura Abbott <[email protected]>--- tools/power/cpupower/utils/cpufreq-set.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)tools/power/cpupower/utils/cpufreq-set.c +1
-1@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)struct cpufreq_affected_cpus *cpus;if (!bitmask_isbitset (cpus_chosen, cpu) || -cpupower_is_cpu_online (cpu)) +cpupower_is_cpu_online (cpu) !=1 )continue ; cpus =cpufreq_get_related_cpus (cpu);
tools/power/cpupower/utils/cpufreq-set.c int cmd_freq_set(int argc, char **argv) · line 322
Quoted 8 lines
tools/power/cpupower/utils/cpufreq-set.c +1
-1@@ -316,7 +316,7 @@ int cmd_freq_set(int argc, char **argv) cpu <= bitmask_last(cpus_chosen); cpu++) {if (!bitmask_isbitset (cpus_chosen, cpu) || -cpupower_is_cpu_online (cpu)) +cpupower_is_cpu_online (cpu) !=1 )continue ;if (cpupower_is_cpu_online (cpu) !=1 )
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Can you also remove the above check where the same condition 'cpupower_is_cpu_online(cpu) != 1' is tested twice ?
Thanks and Regards,
Shilpa