From patchwork Tue Feb 25 08:59:44 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 25244 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-yh0-f70.google.com (mail-yh0-f70.google.com [209.85.213.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C85F320558 for ; Tue, 25 Feb 2014 09:00:09 +0000 (UTC) Received: by mail-yh0-f70.google.com with SMTP id c41sf11879048yho.1 for ; Tue, 25 Feb 2014 01:00:09 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=ooQStW/gjDDookElRKSRFUVRllv+Xsj86syXh5vjvjo=; b=Z3KE+nJbo4rMY6sqHP6fhVEZgX/Bchj+ZxMWcqziVXUXSbCCLJ4AaJDAXgArnmL3bD aPJW3V7vnF/ZY7CDld0Q1xmbaKnbKPDQHhjyA/S/O8G0GpLfKOHe/eBLSgNBwkA+AV3O zJxhFLkvubTNslxrug9DrMODuubF0vLTq8CnRwH8HRQ5+asY93DYOF6MrJpTwhOGFzy2 /HAGDf16QKurkrLT4IsgrZfyLDidpOBNNRchSP2Qy8ewlGbBKukbyOH45JXQSTkz4QAH pbnVy34n+oEqd0TOjRJzEuJC1UzwP47xDfMM6ow1ttWnL7wSjI9xljV46wsJOFFkl5Cs PW1g== X-Gm-Message-State: ALoCoQk8sOgkp0dSOCo4I22jJ8MpDy/nFa+IioS35JvbJ952dDquoUTE12qBX7wvwPwLMqWdxBqN X-Received: by 10.236.137.12 with SMTP id x12mr1468056yhi.17.1393318809107; Tue, 25 Feb 2014 01:00:09 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.91.110 with SMTP id y101ls2408535qgd.0.gmail; Tue, 25 Feb 2014 01:00:09 -0800 (PST) X-Received: by 10.58.37.232 with SMTP id b8mr106321vek.27.1393318808707; Tue, 25 Feb 2014 01:00:08 -0800 (PST) Received: from mail-vc0-f177.google.com (mail-vc0-f177.google.com [209.85.220.177]) by mx.google.com with ESMTPS id kp12si6648265vcb.91.2014.02.25.01.00.08 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 25 Feb 2014 01:00:08 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.220.177; Received: by mail-vc0-f177.google.com with SMTP id if11so6795504vcb.22 for ; Tue, 25 Feb 2014 01:00:08 -0800 (PST) X-Received: by 10.52.27.132 with SMTP id t4mr20681vdg.11.1393318797447; Tue, 25 Feb 2014 00:59:57 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.220.174.196 with SMTP id u4csp122683vcz; Tue, 25 Feb 2014 00:59:56 -0800 (PST) X-Received: by 10.68.171.193 with SMTP id aw1mr5131148pbc.117.1393318793805; Tue, 25 Feb 2014 00:59:53 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id yc8si2882782pbc.217.2014.02.25.00.59.53; Tue, 25 Feb 2014 00:59:53 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-pm-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752457AbaBYI7w (ORCPT + 11 others); Tue, 25 Feb 2014 03:59:52 -0500 Received: from mail-wi0-f172.google.com ([209.85.212.172]:62001 "EHLO mail-wi0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751660AbaBYI7v (ORCPT ); Tue, 25 Feb 2014 03:59:51 -0500 Received: by mail-wi0-f172.google.com with SMTP id e4so4104106wiv.11 for ; Tue, 25 Feb 2014 00:59:50 -0800 (PST) X-Received: by 10.180.25.46 with SMTP id z14mr1426442wif.49.1393318790025; Tue, 25 Feb 2014 00:59:50 -0800 (PST) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id uq2sm48941985wjc.5.2014.02.25.00.59.47 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 25 Feb 2014 00:59:49 -0800 (PST) From: Viresh Kumar To: rjw@rjwysocki.net Cc: linaro-kernel@lists.linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, srivatsa.bhat@linux.vnet.ibm.com, Viresh Kumar Subject: [PATCH V2] cpufreq: Return error if ->get() failed in cpufreq_update_policy() Date: Tue, 25 Feb 2014 14:29:44 +0530 Message-Id: <79539d6c5c04165da855863c4015f90b278d86d1.1393318725.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.220.177 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , cpufreq_update_policy() calls cpufreq_driver->get() to get current frequency of a CPU and it is not supposed to fail or return zero. Return error in case that happens. Signed-off-by: Viresh Kumar --- V1->V2: - Fixed return error to EIO instead of EINVAL - Added WARN_ON() to flag get() failing and hence removed the print message as well which was earlier printed during errors. drivers/cpufreq/cpufreq.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index c755b5f..bf80502 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2139,6 +2139,11 @@ int cpufreq_update_policy(unsigned int cpu) */ if (cpufreq_driver->get) { new_policy.cur = cpufreq_driver->get(cpu); + if (WARN_ON(!new_policy.cur)) { + ret = -EIO; + goto no_policy; + } + if (!policy->cur) { pr_debug("Driver did not initialize current freq"); policy->cur = new_policy.cur;