From patchwork Fri Sep 23 17:16:50 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laura Abbott X-Patchwork-Id: 9348511 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 DF53C6077A for ; Fri, 23 Sep 2016 17:17:05 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CBA9F2AD4E for ; Fri, 23 Sep 2016 17:17:05 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C07FE2AD50; Fri, 23 Sep 2016 17:17:05 +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 A43692AD4E for ; Fri, 23 Sep 2016 17:17:04 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1761469AbcIWRRD (ORCPT ); Fri, 23 Sep 2016 13:17:03 -0400 Received: from mail-io0-f176.google.com ([209.85.223.176]:34581 "EHLO mail-io0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761467AbcIWRRC (ORCPT ); Fri, 23 Sep 2016 13:17:02 -0400 Received: by mail-io0-f176.google.com with SMTP id e66so35201210iod.1 for ; Fri, 23 Sep 2016 10:17:02 -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=A0obCRzS05FX1uOJzE/x78Z8qnjMXj+LqRQnf/u417M=; b=iZF66k+NdIlFvcTMNYkgF64O2jWshEgg2F56RtlMDVcXUNmLays13UH6ZAm2U05jaH VpREyl/vxpchNcZupPlkMDTKPXOb9yJElPLSTbsqIgRijilJ6NFud90jnLMUL7Ox6GyW 4Z5+ae2HUwUj8JGS6AZT2tANQv4mzn4dOY4/ggNA3JGvEkVuaKiF+WqlXRygDKqFZWbZ +1CSOV3j+sJDP+eny1rsLxr3guzMKOoKaU/YGNx4qEYdgghuXPmcQTGvA7HoB0IUhosY WzOcSEyE58RBUondur16JTeQLDZoH50hsQ6PHQLHt1nkfZnR2SWGxaW5yL5B0gs4CcWq CUMg== X-Gm-Message-State: AA6/9RnVZBEaKW9CsdtQOaORFXamX9di2XDdCDhtLfQkhT5y85JD3bNpXs/bi9ODExUdJTGO X-Received: by 10.107.158.80 with SMTP id h77mr10533829ioe.152.1474651021411; Fri, 23 Sep 2016 10:17:01 -0700 (PDT) Received: from labbott-redhat-machine.redhat.com ([2601:602:9800:177f::2946]) by smtp.gmail.com with ESMTPSA id a192sm1521755itc.8.2016.09.23.10.16.59 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 23 Sep 2016 10:17:00 -0700 (PDT) From: Laura Abbott To: Thomas Renninger Cc: Laura Abbott , Shilpasri G Bhat , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCHv2] cpupower: Correct return type of cpu_power_is_cpu_online in cpufreq Date: Fri, 23 Sep 2016 10:16:50 -0700 Message-Id: <1474651010-30883-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 --- v2: Drop another redundant cpupower_is_cpu_online --- 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);