From patchwork Wed Oct 19 22:53:52 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9385565 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id A79B6607D0 for ; Wed, 19 Oct 2016 22:54:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 92C9528D1F for ; Wed, 19 Oct 2016 22:54:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 86CD329281; Wed, 19 Oct 2016 22:54:22 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.4 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 2785C28D1F for ; Wed, 19 Oct 2016 22:54:22 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755452AbcJSWyH (ORCPT ); Wed, 19 Oct 2016 18:54:07 -0400 Received: from mail-qk0-f179.google.com ([209.85.220.179]:33307 "EHLO mail-qk0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755358AbcJSWyF (ORCPT ); Wed, 19 Oct 2016 18:54:05 -0400 Received: by mail-qk0-f179.google.com with SMTP id n189so64362598qke.0 for ; Wed, 19 Oct 2016 15:54:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=+iTmVPuF9OtcTcEtQKS31dImut19UURIxRluwYLkgAM=; b=HAnvjwSnCrPLgEO34apRCJiyz8waSfzzCIfNU1s9TyfXHRP7hee43laKXYvHYpakhv huE4SmZzHG0YIxCD5cVl9BKd2rhZEtZoXrFV2UT/2dyG1usgqaRPH88Y8fiBC/3Xzg/L PSHhkgiUryjg92nhXyrlpSIyhYxMmog/GDGQTx37O9AKn3Zug1WEJTuh0mx7xodGlvNV PL5oyPlmkzeT51RFeOCiN6PeAADlKgqXRlZCDWOmwX0ePiOPx7ccmZXAZg1J78uvoYiR DxMu+JP5dRy51PEabyYfkj7ZinKID6vgXl0tcZ8+s7Kldep6rvTvgzXGw3XSJAJW5sx2 6tIA== X-Gm-Message-State: ABUngvcYzUA8LCqODNOSCud4USDRarZV8UgyQ1C+cB0Btq66BJsSv/6+agm5jbaAoG4epvRI X-Received: by 10.55.33.65 with SMTP id h62mr5907397qkh.93.1476917644539; Wed, 19 Oct 2016 15:54:04 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::3aaa]) by smtp.gmail.com with ESMTPSA id h14sm22025254qth.44.2016.10.19.15.54.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 19 Oct 2016 15:54:03 -0700 (PDT) From: Laura Abbott To: Thomas Renninger Cc: Laura Abbott , Shilpasri G Bhat , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, "Rafael J. Wysocki" Subject: [RESEND][PATCHv2] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq Date: Wed, 19 Oct 2016 15:53:52 -0700 Message-Id: <1476917632-7831-1-git-send-email-labbott@redhat.com> X-Mailer: git-send-email 2.7.4 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by:Shilpasri G Bhat Acked-by: Thomas Renninger --- v2: Drop another redundant cpupower_is_cpu_online Resend because I've heard nothing about this patch and it's still broken as far as I can tell. --- tools/power/cpupower/utils/cpufreq-set.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/tools/power/cpupower/utils/cpufreq-set.c b/tools/power/cpupower/utils/cpufreq-set.c index b4bf769..1eef0ae 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,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);