Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755578AbdIRLpS (ORCPT ); Mon, 18 Sep 2017 07:45:18 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:43413 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754130AbdIRLpQ (ORCPT ); Mon, 18 Sep 2017 07:45:16 -0400 From: Abhishek Goel To: trenn@suse.com, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Abhishek Goel Subject: [PATCH] cpupowerutils: bench - Fix cpu online check Date: Mon, 18 Sep 2017 17:14:26 +0530 X-Mailer: git-send-email 2.9.3 X-TM-AS-MML: disable x-cbid: 17091811-0040-0000-0000-00000356AA58 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17091811-0041-0000-0000-00000CD73E6F Message-Id: <20170918114426.96911-1-huntbag@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2017-09-18_03:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1709180169 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 838 Lines: 24 cpupower_is_cpu_online returns 1 when cpu is online. But in function set_cpufreq_governor, it was incorrectly checking for 0 in case cpu is online. Signed-off-by: Abhishek Goel --- tools/power/cpupower/bench/system.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/power/cpupower/bench/system.c b/tools/power/cpupower/bench/system.c index c25a74a..2bb3eef 100644 --- a/tools/power/cpupower/bench/system.c +++ b/tools/power/cpupower/bench/system.c @@ -61,7 +61,7 @@ int set_cpufreq_governor(char *governor, unsigned int cpu) dprintf("set %s as cpufreq governor\n", governor); - if (cpupower_is_cpu_online(cpu) != 0) { + if (cpupower_is_cpu_online(cpu) != 1) { perror("cpufreq_cpu_exists"); fprintf(stderr, "error: cpu %u does not exist\n", cpu); return -1; -- 2.9.3