From patchwork Fri Feb 14 11:00:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 24622 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-la0-f72.google.com (mail-la0-f72.google.com [209.85.215.72]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id F2817203C4 for ; Fri, 14 Feb 2014 11:00:59 +0000 (UTC) Received: by mail-la0-f72.google.com with SMTP id pv20sf20722301lab.7 for ; Fri, 14 Feb 2014 03:00:57 -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=JAI3CMzgXBSyHg8komYpRnEDQky2vn1iMdKx+iYihr8=; b=LasuRyTryDiZ8KnjyCSPrqa/ujNJGaMc8BT0IjP5dleZ5jCLOoA3pw/Gm2z0w/pBya xkYHqebWZ31KIIxypJPRZ9UI+yvmehFCkmXLHfeUFp+BBnA9kLUguzMOR463Ua7rcEWM EmfMeaVoy9HYshq8wuFY6CsJEdpyj/CR2CX5IG77rpKpbJSXWUpv+cWdsxKHADHOG+uz 5Wm6JSYKF8/WakgRphc9bEPvQuFileBeTE+hlgJhswdtnCugmMr/d9KTFyrrDZPBCTqi Kip7cpDt6VvsV3HRikSEDsGwSQUDNoZQfxRk6pz+EBzH+mCbR2V9cJ8FRcjcQQ+63O1r lmWA== X-Gm-Message-State: ALoCoQlN4KIyQvsGhfWSSAFhOu9pqLtM9PFcimcp+1bxfevj/9tQ2a8zOXe4z+RQzrzYDTlnkozs X-Received: by 10.112.60.198 with SMTP id j6mr3621007lbr.8.1392375657635; Fri, 14 Feb 2014 03:00:57 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.32.116 with SMTP id g107ls38818qgg.49.gmail; Fri, 14 Feb 2014 03:00:57 -0800 (PST) X-Received: by 10.52.30.230 with SMTP id v6mr4198918vdh.6.1392375657513; Fri, 14 Feb 2014 03:00:57 -0800 (PST) Received: from mail-vc0-f174.google.com (mail-vc0-f174.google.com [209.85.220.174]) by mx.google.com with ESMTPS id sm10si1792083vec.81.2014.02.14.03.00.57 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Fri, 14 Feb 2014 03:00:57 -0800 (PST) Received-SPF: neutral (google.com: 209.85.220.174 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.174; Received: by mail-vc0-f174.google.com with SMTP id im17so9280773vcb.33 for ; Fri, 14 Feb 2014 03:00:57 -0800 (PST) X-Received: by 10.52.232.168 with SMTP id tp8mr628126vdc.38.1392375657094; Fri, 14 Feb 2014 03:00: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 u4csp99605vcz; Fri, 14 Feb 2014 03:00:56 -0800 (PST) X-Received: by 10.66.217.133 with SMTP id oy5mr8502112pac.46.1392375656085; Fri, 14 Feb 2014 03:00:56 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ye6si5371494pbc.260.2014.02.14.03.00.54; Fri, 14 Feb 2014 03:00:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of cpufreq-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 S1751566AbaBNLAx (ORCPT + 6 others); Fri, 14 Feb 2014 06:00:53 -0500 Received: from mail-wi0-f179.google.com ([209.85.212.179]:42860 "EHLO mail-wi0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751288AbaBNLAw (ORCPT ); Fri, 14 Feb 2014 06:00:52 -0500 Received: by mail-wi0-f179.google.com with SMTP id hn9so340395wib.6 for ; Fri, 14 Feb 2014 03:00:51 -0800 (PST) X-Received: by 10.180.101.40 with SMTP id fd8mr1664547wib.1.1392375651411; Fri, 14 Feb 2014 03:00:51 -0800 (PST) Received: from localhost ([213.122.173.131]) by mx.google.com with ESMTPSA id v6sm3208381wif.0.2014.02.14.03.00.48 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Fri, 14 Feb 2014 03:00:50 -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, pierre-list@ossman.eu, Viresh Kumar Subject: [PATCH 1/2] cpufreq: Return error if ->get() failed in cpufreq_update_policy() Date: Fri, 14 Feb 2014 16:30:40 +0530 Message-Id: <15ccc0609cb9ee3db0ad3a95b29bf69d11ea197c.1392375504.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e Sender: cpufreq-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: cpufreq@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.174 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 --- Pierre, I don't think this will fix the issue you were facing but might supress it :).. And so you need to understand what causes your ->get() to return zero. @Rafael: I got to these patches while looking at code recently after Pierre complained about. Came to this conclusion after having discussions with Srivatsa over IRC.. drivers/cpufreq/cpufreq.c | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 08ca8c9..383362b 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -2151,6 +2151,13 @@ int cpufreq_update_policy(unsigned int cpu) */ if (cpufreq_driver->get) { new_policy.cur = cpufreq_driver->get(cpu); + + if (!new_policy.cur) { + pr_err("%s: ->get() returned 0 KHz\n", __func__); + ret = -EINVAL; + goto no_policy; + } + if (!policy->cur) { pr_debug("Driver did not initialize current freq"); policy->cur = new_policy.cur;