From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id DEDD3C433DF for ; Tue, 16 Jun 2020 16:06:49 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AFB36208D5 for ; Tue, 16 Jun 2020 16:06:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592323609; bh=dyqp+Fnlnyi5NeHTmMqL6I3YbaA5yLh7dj/yLkB9YR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=vd/RcGUwGVt2OBiaC6/Y8z1p0mLDw931Fc6Y7FhX6XTx1X/YCMHLoMt1zulqI27tI jdKDkbW1aV0U8sWQyweWFYE7RstiAfVN7SZWyASOTlPlGpzumO1rGl/QaGNtRK59ji 6aFepZmm6fyHkt1G7M16rYNAxizFemZzDPALToMQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732966AbgFPQGs (ORCPT ); Tue, 16 Jun 2020 12:06:48 -0400 Received: from mail.kernel.org ([198.145.29.99]:41122 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732354AbgFPPrj (ORCPT ); Tue, 16 Jun 2020 11:47:39 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 1A24920776; Tue, 16 Jun 2020 15:47:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592322458; bh=dyqp+Fnlnyi5NeHTmMqL6I3YbaA5yLh7dj/yLkB9YR8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r7xws0yn4ghR/pp8YZLdYivxZCgWKO7MnvZYorhH+KaJ7b5okWn4RF1i7ov3briv5 bXUJQvBAh042DnsPaIMbqpFP9nyaSHe3SmaY2gzJeLJYQ6sxMO6LbfA8UHoV8aefK+ F79UzgySrx948+CA4WvitBmApfNyf1aoC/XoxpnM= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Serge Semin , Xiongfeng Wang , Viresh Kumar , "Rafael J. Wysocki" Subject: [PATCH 5.7 122/163] cpufreq: Fix up cpufreq_boost_set_sw() Date: Tue, 16 Jun 2020 17:34:56 +0200 Message-Id: <20200616153112.655066932@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200616153106.849127260@linuxfoundation.org> References: <20200616153106.849127260@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rafael J. Wysocki commit 552abb884e97d26589964e5a8c7e736f852f95f0 upstream. After commit 18c49926c4bf ("cpufreq: Add QoS requests for userspace constraints") the return value of freq_qos_update_request(), that can be 1, passed by cpufreq_boost_set_sw() to its caller sometimes confuses the latter, which only expects to see 0 or negative error codes, so notice that cpufreq_boost_set_sw() can return an error code (which should not be -EINVAL for that matter) as soon as the first policy without a frequency table is found (because either all policies have a frequency table or none of them have it) and rework it to meet its caller's expectations. Fixes: 18c49926c4bf ("cpufreq: Add QoS requests for userspace constraints") Reported-by: Serge Semin Reported-by: Xiongfeng Wang Acked-by: Viresh Kumar Cc: 5.3+ # 5.3+ Signed-off-by: Rafael J. Wysocki Signed-off-by: Greg Kroah-Hartman --- drivers/cpufreq/cpufreq.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2535,26 +2535,27 @@ EXPORT_SYMBOL_GPL(cpufreq_update_limits) static int cpufreq_boost_set_sw(int state) { struct cpufreq_policy *policy; - int ret = -EINVAL; for_each_active_policy(policy) { + int ret; + if (!policy->freq_table) - continue; + return -ENXIO; ret = cpufreq_frequency_table_cpuinfo(policy, policy->freq_table); if (ret) { pr_err("%s: Policy frequency update failed\n", __func__); - break; + return ret; } ret = freq_qos_update_request(policy->max_freq_req, policy->max); if (ret < 0) - break; + return ret; } - return ret; + return 0; } int cpufreq_boost_trigger_state(int state)