Message ID | 94d5e5e04cb8278ae9798a6a2837063152dd60aa.1424345053.git.viresh.kumar@linaro.org |
---|---|
State | New |
Headers | show
Return-Path: <patchwork-forward+bncBCRIZROPVQPBBIUUS6TQKGQEI3AQTCA@linaro.org> X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f71.google.com (mail-ee0-f71.google.com [74.125.83.71]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 4F5CF21554 for <linaro@patches.linaro.org>; Thu, 19 Feb 2015 11:33:55 +0000 (UTC) Received: by mail-ee0-f71.google.com with SMTP id d17sf5114495eek.2 for <linaro@patches.linaro.org>; Thu, 19 Feb 2015 03:33:54 -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:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=10xyK/tOAOnyn8/ewv2ggN48QBdvbCfpWcyfzsgONlY=; b=gpJ97g2qOuEOLM6ccZJxg1IPrhLvJpmnEZcqzFs8uyTf9JjxrhfCcy9NUpD0AqR4Nf b1XkvXvMeuqOd5sOZCKKugYzr1+Nc0n3WHy0prCEjRqOYbKafgx3tzjJ7HDI1SslF3KQ fYMRKS1UD322OADE2y0uvdGKWM1a1fuy41nQPE2ALNKGgk830bznq1kh0OOnaTfZiYNr CxLIeZwvOdsxuvkQyO/10RnsP+s9daTt9gAYCukg7GoeV5YBD9igyuYl8wzJA+9k+9f/ cLWiuzNhzCMJW7jzCj73EH2CKxKkq0+kHLeSZyOIQCzUWjxtutVMh0WOa/flacVeuP0f u+Cw== X-Gm-Message-State: ALoCoQlfwcDnstkrUQvyttponDv0QlL2WzmgXwlSmvI/DcbIuut7gYC3e/qj/yxj8t6Z5a7C3Pca X-Received: by 10.112.181.198 with SMTP id dy6mr526159lbc.22.1424345634618; Thu, 19 Feb 2015 03:33:54 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.87.140 with SMTP id ay12ls161733lab.2.gmail; Thu, 19 Feb 2015 03:33:54 -0800 (PST) X-Received: by 10.152.180.202 with SMTP id dq10mr3468213lac.74.1424345634475; Thu, 19 Feb 2015 03:33:54 -0800 (PST) Received: from mail-la0-f49.google.com (mail-la0-f49.google.com. [209.85.215.49]) by mx.google.com with ESMTPS id b5si12012910laf.90.2015.02.19.03.33.54 for <patchwork-forward@linaro.org> (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 19 Feb 2015 03:33:54 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) client-ip=209.85.215.49; Received: by labpv20 with SMTP id pv20so6956828lab.8 for <patchwork-forward@linaro.org>; Thu, 19 Feb 2015 03:33:54 -0800 (PST) X-Received: by 10.112.118.211 with SMTP id ko19mr3139891lbb.19.1424345634386; Thu, 19 Feb 2015 03:33:54 -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.112.35.133 with SMTP id h5csp431630lbj; Thu, 19 Feb 2015 03:33:53 -0800 (PST) X-Received: by 10.70.136.66 with SMTP id py2mr6943780pdb.100.1424345632563; Thu, 19 Feb 2015 03:33:52 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id on3si3330575pac.16.2015.02.19.03.33.51; Thu, 19 Feb 2015 03:33:52 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076AbbBSLdu (ORCPT <rfc822;amit.pundir@linaro.org> + 11 others); Thu, 19 Feb 2015 06:33:50 -0500 Received: from mail-pd0-f179.google.com ([209.85.192.179]:46933 "EHLO mail-pd0-f179.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753237AbbBSLdd (ORCPT <rfc822;linux-pm@vger.kernel.org>); Thu, 19 Feb 2015 06:33:33 -0500 Received: by pdjy10 with SMTP id y10so8220531pdj.13 for <linux-pm@vger.kernel.org>; Thu, 19 Feb 2015 03:33:33 -0800 (PST) X-Received: by 10.68.65.33 with SMTP id u1mr6976153pbs.114.1424345613123; Thu, 19 Feb 2015 03:33:33 -0800 (PST) Received: from localhost ([122.172.249.58]) by mx.google.com with ESMTPSA id g7sm11535095pdm.4.2015.02.19.03.33.31 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 19 Feb 2015 03:33:32 -0800 (PST) From: Viresh Kumar <viresh.kumar@linaro.org> To: Rafael Wysocki <rjw@rjwysocki.net> Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, sboyd@codeaurora.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar <viresh.kumar@linaro.org> Subject: [PATCH V2 03/20] cpufreq: Throw warning when we try to get policy for an invalid CPU Date: Thu, 19 Feb 2015 17:02:05 +0530 Message-Id: <94d5e5e04cb8278ae9798a6a2837063152dd60aa.1424345053.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.3.0.rc0.44.ga94655d In-Reply-To: <cover.1424345053.git.viresh.kumar@linaro.org> References: <cover.1424345053.git.viresh.kumar@linaro.org> In-Reply-To: <cover.1424345053.git.viresh.kumar@linaro.org> References: <cover.1424345053.git.viresh.kumar@linaro.org> Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: <patchwork-forward.linaro.org> 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.49 as permitted sender) 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: <http://groups.google.com/a/linaro.org/group/patchwork-forward/post>, <mailto:patchwork-forward@linaro.org> List-Help: <http://support.google.com/a/linaro.org/bin/topic.py?topic=25838>, <mailto:patchwork-forward+help@linaro.org> List-Archive: <http://groups.google.com/a/linaro.org/group/patchwork-forward/> List-Unsubscribe: <mailto:googlegroups-manage+836684582541+unsubscribe@googlegroups.com>, <http://groups.google.com/a/linaro.org/group/patchwork-forward/subscribe> |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 4884caf92bff..9da8ed5bdd21 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -229,7 +229,7 @@ struct cpufreq_policy *cpufreq_cpu_get(unsigned int cpu) struct cpufreq_policy *policy = NULL; unsigned long flags; - if (cpu >= nr_cpu_ids) + if (WARN_ON(cpu >= nr_cpu_ids)) return NULL; if (!down_read_trylock(&cpufreq_rwsem))
Simply returning here with an error is not enough. It shouldn't be allowed at all to try calling cpufreq_cpu_get() for an invalid CPU. Add a WARN here to make it clear that it wouldn't be acceptable at all. Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org> --- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)