From patchwork Thu Aug 27 05:24:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 248421 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp125231ils; Wed, 26 Aug 2020 22:24:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxf+hW+3QRKLGNSteFXtbg7I19FhKhIx2l9VBKeU1H1jPfhHwDJfoDtuSb+BAySApM/9AQr X-Received: by 2002:a17:906:c187:: with SMTP id g7mr20122144ejz.108.1598505864049; Wed, 26 Aug 2020 22:24:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598505864; cv=none; d=google.com; s=arc-20160816; b=vS/U76dvfX30pOAAV7eSqkKmAMpb7T2E0LS/N79GvQ4rTS8MsB1su2ol5tVxyCV1rZ 0SoyQcxILfCAL7cnTmtkPHouVHewc7AaDalbTKMDBCSh0qChcoeHpC7zgUlgqjUpplyt 5HR+Br4RG0+WDosUG+kQpK0m6HX9ZzLUtCK4/WbO7PRcdCZSxhi/vEvNF92QazsMXzt/ DUUppRPyZepS3d7c4QIA8mrKyno30GpmOCetZXEmdp1UmkJ5CVPAHY2Wko1nfjyGLKUe nQhJICxbPhNS/b/R70wxdgfxMm3gSGaRg4kBXHbln1MGvnvJX+D55O5Uwjl/UjONskz1 I9OQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=fWnOmZQiE1diGG7f4xMEwIVX10lb7UFm+giUYyHedJQ=; b=WAqz4Nks/RM4BAQaADCeR+D/FzTTu96QJQpX8KvMcK6zLr8QG4+N1onXNhwvouzbBT EHrjvDVQ2jM4vNsKs6bolEEBBQKICYOhOlaHP1Bvex4PXcXzwf5RUROpheFpHjWVA81D gSGJpuKzCzkty0gUQ1zX/OUbtLhw1Mb/6MfsGETBuBPVAjdJZmvA0AcdtUBtvh4t1a61 xbLylqGDmB9YqcMhFJo651HpKGZlISXD6gffG70VWz0rQMFntHu0bYsuS0d1ERxe00qo gLwtnRo4O41URZfA+LNbAbcXT2sZj3vmo7KoqKEGofDfl7WKFzdgyC0QGkWEfnwYnplO SEvw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kRaZNdmG; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x17si806726edi.428.2020.08.26.22.24.23; Wed, 26 Aug 2020 22:24:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=kRaZNdmG; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726070AbgH0FYW (ORCPT + 10 others); Thu, 27 Aug 2020 01:24:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57302 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726028AbgH0FYW (ORCPT ); Thu, 27 Aug 2020 01:24:22 -0400 Received: from mail-pg1-x541.google.com (mail-pg1-x541.google.com [IPv6:2607:f8b0:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56249C061240 for ; Wed, 26 Aug 2020 22:24:22 -0700 (PDT) Received: by mail-pg1-x541.google.com with SMTP id i10so2533277pgk.1 for ; Wed, 26 Aug 2020 22:24:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fWnOmZQiE1diGG7f4xMEwIVX10lb7UFm+giUYyHedJQ=; b=kRaZNdmGKAg4HLrE/uGXgzjrobjeg9t/Pk1pY/YiXJZG9LKcE3HWgvpc4pXBQdT/Dp BaxA6FsrvZamlFnpGRQfXE9kC616WOSDQ+UkXmHO/nVFHtVRF3KfvAlKf0HVXh4O9ED3 RpTwruLbf3b8F+mcY1Z9kMuuz7h6G9SICrgihKOAfx8BPtrYjBw9dDEDjZ3f2Y2aCD7b /uQWeevM+9Lk0bvjrRJMSn9D+v/jHpvXY+fyM2NVl5fuXGJMU35CMX3EOqBr5vRBq9gw cUI0oG4KZ6HRY4MaES8SY9+2m1Wx2QSkcsw8LU7zafJbDKf4IVnSwo9VMnNgBjCljAp4 OBqA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fWnOmZQiE1diGG7f4xMEwIVX10lb7UFm+giUYyHedJQ=; b=cbRK0xmUzKNknkNA/85R581Mrtr0xSsjodNiUSZfNPZj8JvEG5LsxvOBixxngyTeHg FDBUU90IagVi5l8p0w4WRRsMUS59DAimNZpN5u70a8maKpSiWb0zv6Tuy9Xi6Fe1/wYM KA93VnLmCIK+1zX5MYtjh5ZqEcSt0Sm0hX5Fa6YXeFPov9RqXaDycf2+nKY3Tt3JR7ww pJN6XX2yS4fC4YlJemGbF4PiFs7H9XQgk3lmHweNva6Ge0eH19Sg2/XTFkN7ILpl8eh9 /1DrhxQ25FZu1yuWaNHHA8p3EwbhEhiQkDjjoAH1GyAah3T39bGWWrGKNQ+6XjMa1RTz R77w== X-Gm-Message-State: AOAM531HFtTuTPcOtrOKaguCH2WrKuqbnTKBWaL8XRO2c6pEBZYnkrRb 13jvJx3PbVf7zGFWof8+MN4c1Q== X-Received: by 2002:aa7:91ce:: with SMTP id z14mr7473320pfa.241.1598505861790; Wed, 26 Aug 2020 22:24:21 -0700 (PDT) Received: from localhost ([122.167.135.199]) by smtp.gmail.com with ESMTPSA id mp1sm858405pjb.27.2020.08.26.22.24.20 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2020 22:24:21 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 1/2] cpufreq: No need to verify cpufreq_driver in show_scaling_cur_freq() Date: Thu, 27 Aug 2020 10:54:15 +0530 Message-Id: <906198d77aa73613a1b588425aa45e5025ee60cb.1598505843.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org "cpufreq_driver" is guaranteed to be valid here, no need to check it here. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) -- 2.25.0.rc1.19.g042ed3e048af diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 02ab56b2a0d8..47aa90f9a7c2 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -703,8 +703,7 @@ static ssize_t show_scaling_cur_freq(struct cpufreq_policy *policy, char *buf) freq = arch_freq_get_on_cpu(policy->cpu); if (freq) ret = sprintf(buf, "%u\n", freq); - else if (cpufreq_driver && cpufreq_driver->setpolicy && - cpufreq_driver->get) + else if (cpufreq_driver->setpolicy && cpufreq_driver->get) ret = sprintf(buf, "%u\n", cpufreq_driver->get(policy->cpu)); else ret = sprintf(buf, "%u\n", policy->cur); From patchwork Thu Aug 27 05:24:16 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 248422 Delivered-To: patch@linaro.org Received: by 2002:a05:6e02:522:0:0:0:0 with SMTP id h2csp125269ils; Wed, 26 Aug 2020 22:24:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzM2OHuUn9vFlkx7iK74429xz4Yc0K5dbtcbd3etmahnAVD5Avh4043oD4UUvgmvdTFarSU X-Received: by 2002:a17:906:59b:: with SMTP id 27mr20297048ejn.56.1598505868012; Wed, 26 Aug 2020 22:24:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598505868; cv=none; d=google.com; s=arc-20160816; b=bwtY8BgXeK+yOxa4U7z3MrQFKnK2mlKrNIrec8L2P8ltIFGmVx9XecBvX7aHUghL3l loazEAL5r5Bmb2n6RxPdBciOrybQalneIDuzilHeOMqR4TLQAFZfZzc9rzITAvsggLxP FAECpWQ5ROJZMncSCfygyQWl6XgeWPEqalsWyyaRg/ccq3H77yKHsz1SRuI7bzS4jq/B WZpsoLEK6bUF9qODLoIKVRlIfTA9jwJrmu6NZnQdNEKvDMPVi8a2FnY5VNzCUbdfEuph oRt5P5El4OoZyb+PO3xxKana0IoDWYauPwbEbbBhuikT3P6B2IxNtCSWPuV4cjJwz2WV 4EzQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=LhfHAFDbpQiI2qmNMkVR2Ozx/52piMfWpn81D9slgEk=; b=UNiyASfpfi0amOUD27+TLzn6WHuGEzHGLIoGWtuQXEm6ucXITBSsi+DAk/bG1g5N8F pcndDybZ8l63pXh6f9t1B0g29MkKtz4J+OxpVkiPTcIRp4Is8jZDy8TJdQdeIPZont+1 Nl+Bo1c3c1yH3f6MsksI7QDXw13YuL/5fjei5bZnYj93PIm03uwgbpGPLxAgHq3kS8rY eC3iZ+sbpfbeS77cNIB5+9wj79tuldbzm0z28V+vflRf1TpAWpgnJHCsF/wYOooLYsTb ob0nJF9PFDizUTPDtFg10kaQaeUIxej8KVa2afB0X3UKrl06rAs8v5N5cGM2M2cwfYF6 0Yhg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iEail3GA; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b18si643339ejg.50.2020.08.26.22.24.27; Wed, 26 Aug 2020 22:24:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=iEail3GA; spf=pass (google.com: domain of linux-pm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-pm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726839AbgH0FY1 (ORCPT + 10 others); Thu, 27 Aug 2020 01:24:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57312 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726820AbgH0FYZ (ORCPT ); Thu, 27 Aug 2020 01:24:25 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 821FDC061244 for ; Wed, 26 Aug 2020 22:24:25 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id t185so2575654pfd.13 for ; Wed, 26 Aug 2020 22:24:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=LhfHAFDbpQiI2qmNMkVR2Ozx/52piMfWpn81D9slgEk=; b=iEail3GAFJeMcRamyGcoOWimiwBP3351QoCwb550QfDEmueo2f5Up1cP1aRZpsUxf5 knnL3BCvhCPLy7nj8b/R1U4aMJ7HBRUl+aTWqz5FnjPBfekU6WrUyK0MZA7A8xNOF/Yu 3IOVZwTyff0eyOVo6JvUObWBRPKo9RAcQwytJQkYkIe8OK67mP3l8IxypnMDoNY5x6uO XD6MGAcFXCi5qmTbZ6XHFMTimoDaRAU0bG3FW7RmCIZMUn3LO6BOQmP2XtpircSXOnKY 0j4KYNtc/e3Ob+HE/6MSRrdeTrlOKWgM5tMKAlIGg8EWaHr+EZ4oYCEjM5GnKHXcYVqk jg/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=LhfHAFDbpQiI2qmNMkVR2Ozx/52piMfWpn81D9slgEk=; b=fkqblOBuQNwt/o+7j3zcZoDuOSQP4Iip1i+BxFmpxSuAxpkLMyBGlmGAXihPKJTNVr OwndahqzvHV6dhrRcRmuL66rtmq0Z6APxXY8MjNCCR1T33ssJtRROfB+oIa+uByfWFYY Lv7Dhtxvfn3udhzmJg0qm3cuQ+p9P77q+d9HJzsLgQmHHWijqWfI/BmPiArbP+ediELf ffvLEc3K7eddPZwNbzfiX9f/OIPvelBgd98i+Skh47zYYHuFxWy1KHGO7oDEv3M/Orea gN6+wGMRc8kZhDUh4U5Y39jUJhWw8nnoBPTPfTfM/8W3QU9m8sE6977iv7mEwj1EuZtC jntA== X-Gm-Message-State: AOAM531o4utiUVg2cVmNkrhgeikZpNyf6cGou6t7CuX9xXd25kM3IFo2 JxD/0CARjnIeBcYx5l61DWw46g== X-Received: by 2002:a63:4144:: with SMTP id o65mr13004377pga.8.1598505865037; Wed, 26 Aug 2020 22:24:25 -0700 (PDT) Received: from localhost ([122.167.135.199]) by smtp.gmail.com with ESMTPSA id j14sm777047pgj.3.2020.08.26.22.24.24 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 26 Aug 2020 22:24:24 -0700 (PDT) From: Viresh Kumar To: Rafael Wysocki , Viresh Kumar Cc: linux-pm@vger.kernel.org, Vincent Guittot , linux-kernel@vger.kernel.org Subject: [PATCH 2/2] cpufreq: Do WARN() for invalid relation Date: Thu, 27 Aug 2020 10:54:16 +0530 Message-Id: <1c643a64707d889e0ccab641df78c7a620325697.1598505843.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.25.0.rc1.19.g042ed3e048af In-Reply-To: <906198d77aa73613a1b588425aa45e5025ee60cb.1598505843.git.viresh.kumar@linaro.org> References: <906198d77aa73613a1b588425aa45e5025ee60cb.1598505843.git.viresh.kumar@linaro.org> MIME-Version: 1.0 Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org The relation can't be invalid here, if it is just WARN() and return 0. Signed-off-by: Viresh Kumar --- include/linux/cpufreq.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) -- 2.25.0.rc1.19.g042ed3e048af diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index 8f141d4c859c..a911e5d06845 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -956,8 +956,8 @@ static inline int cpufreq_frequency_table_target(struct cpufreq_policy *policy, case CPUFREQ_RELATION_C: return cpufreq_table_find_index_c(policy, target_freq); default: - pr_err("%s: Invalid relation: %d\n", __func__, relation); - return -EINVAL; + WARN_ON_ONCE(1); + return 0; } }