From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1161050AbcIWQSF (ORCPT ); Fri, 23 Sep 2016 12:18:05 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:58778 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965949AbcIWQSD (ORCPT ); Fri, 23 Sep 2016 12:18:03 -0400 Subject: Re: [PATCH] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq To: Laura Abbott , Thomas Renninger References: <1473441919-7809-1-git-send-email-labbott@redhat.com> Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org From: Shilpasri G Bhat Date: Fri, 23 Sep 2016 21:47:53 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2 MIME-Version: 1.0 In-Reply-To: <1473441919-7809-1-git-send-email-labbott@redhat.com> Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 16092316-0008-0000-0000-000000C8799D X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 16092316-0009-0000-0000-00000824E17D Message-Id: X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2016-09-23_07:,, 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-1609020000 definitions=main-1609230301 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 09/09/2016 10:55 PM, Laura Abbott wrote: > 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 > > Fixes: ac5a181d065d ("cpupower: Add cpuidle parts into library") > Reported-by: Julian Seward > Signed-off-by: Laura Abbott > --- > tools/power/cpupower/utils/cpufreq-set.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c > index b4bf769..8971d71 100644 > --- a/tools/power/cpupower/utils/cpufreq-set.c > +++ b/tools/power/cpupower/utils/cpufreq-set.c > @@ -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) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Can you also remove the above check where the same condition 'cpupower_is_cpu_online(cpu) != 1' is tested twice ? Thanks and Regards, Shilpa