Skip to content

Commit

Permalink
cpupower: Correct return type of cpu_power_is_cpu_online() in cpufreq…
Browse files Browse the repository at this point in the history
…-set

When converting to a shared library in ac5a181 ("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.

Link: https://bugzilla.redhat.com/show_bug.cgi?id=1374212
Fixes: ac5a181 (cpupower: Add cpuidle parts into library)
Reported-by: Julian Seward <jseward@acm.org>
Signed-off-by: Laura Abbott <labbott@redhat.com>
Acked-by: Thomas Renninger <trenn@suse.com>
Cc: 4.7+ <stable@vger.kernel.org> # 4.7+
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Laura Abbott authored and Rafael J. Wysocki committed Nov 1, 2016
1 parent a909d3e commit c25badc
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions tools/power/cpupower/utils/cpufreq-set.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -316,10 +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))
continue;

if (cpupower_is_cpu_online(cpu) != 1)
cpupower_is_cpu_online(cpu) != 1)
continue;

printf(_("Setting cpu: %d\n"), cpu);
Expand Down

0 comments on commit c25badc

Please sign in to comment.