5c9789d
From 9f692cbe4a01dd9e3c3e954ec6b59662b68f9ce4 Mon Sep 17 00:00:00 2001
5c9789d
From: Laura Abbott <labbott@redhat.com>
5c9789d
Date: Fri, 9 Sep 2016 10:19:02 -0700
5c9789d
Subject: [PATCH] cpupower: Correct return type of cpu_power_is_cpu_online in
5c9789d
 cpufreq
5c9789d
To: Thomas Renninger <trenn@suse.com>
5c9789d
Cc: linux-pm@vger.kernel.org
5c9789d
Cc: linux-kernel@vger.kernel.org
5c9789d
5c9789d
When converting to a shared library in ac5a181d065d ("cpupower: Add
5c9789d
cpuidle parts into library"), cpu_freq_cpu_exists was converted to
5c9789d
cpupower_is_cpu_online. cpu_req_cpu_exists returned 0 on success and
5c9789d
-ENOSYS on failure whereas cpupower_is_cpu_online returns 1 on success.
5c9789d
Check for the correct return value in cpufreq-set.
5c9789d
5c9789d
See https://bugzilla.redhat.com/show_bug.cgi?id=1374212
5c9789d
5c9789d
Fixes: ac5a181d065d ("cpupower: Add cpuidle parts into library")
5c9789d
Reported-by: Julian Seward <jseward@acm.org>
5c9789d
Signed-off-by: Laura Abbott <labbott@redhat.com>
5c9789d
---
5c9789d
 tools/power/cpupower/utils/cpufreq-set.c | 4 ++--
5c9789d
 1 file changed, 2 insertions(+), 2 deletions(-)
5c9789d
5c9789d
diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c
5c9789d
index b4bf769..8971d71 100644
5c9789d
--- a/tools/power/cpupower/utils/cpufreq-set.c
5c9789d
+++ b/tools/power/cpupower/utils/cpufreq-set.c
5c9789d
@@ -296,7 +296,7 @@ int cmd_freq_set(int argc, char **argv)
5c9789d
 			struct cpufreq_affected_cpus *cpus;
5c9789d
 
5c9789d
 			if (!bitmask_isbitset(cpus_chosen, cpu) ||
5c9789d
-			    cpupower_is_cpu_online(cpu))
5c9789d
+			    cpupower_is_cpu_online(cpu) != 1)
5c9789d
 				continue;
5c9789d
 
5c9789d
 			cpus = cpufreq_get_related_cpus(cpu);
5c9789d
@@ -316,7 +316,7 @@ int cmd_freq_set(int argc, char **argv)
5c9789d
 	     cpu <= bitmask_last(cpus_chosen); cpu++) {
5c9789d
 
5c9789d
 		if (!bitmask_isbitset(cpus_chosen, cpu) ||
5c9789d
-		    cpupower_is_cpu_online(cpu))
5c9789d
+		    cpupower_is_cpu_online(cpu) != 1)
5c9789d
 			continue;
5c9789d
 
5c9789d
 		if (cpupower_is_cpu_online(cpu) != 1)
5c9789d
-- 
5c9789d
2.10.0
5c9789d