From patchwork Fri Jan 2 05:46:39 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42660 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-wi0-f200.google.com (mail-wi0-f200.google.com [209.85.212.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 2916E26CB5 for ; Fri, 2 Jan 2015 05:47:16 +0000 (UTC) Received: by mail-wi0-f200.google.com with SMTP id ex7sf10402670wid.11 for ; Thu, 01 Jan 2015 21:47:15 -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=0Xglql/6QeOUqUFZcFlVzrqC0wpBlfTdwA24jTdTDxg=; b=RKwNTv9pw89CEpFOGXER4vxsWQRakS23QLwllIa0gnZWClujuvZSTmH+pAUuS+vmo4 3uJ2DXZDEldFn0EMRZmoI5h1gUCtRzLSomQluUDBSt48S0AolXKlV/53MdnkXaSH42YO wx6Rm55j0H2dQD/5Az+D1BgkshJpE+QguuX/RQbjmA5KdqQPKQW4lQ1VfO9RXAa2jNCx NqwICcs7nqEKlfjqAuoGGawnKGm1N3ZmgwO0eUHtEbNB3lwe4CKbBLA8jmcPhc+GwhPz cZuSVa0pv1hb1QAt9jLKbzJlQ7FQW8ZsSMFIGkiE4XDfMW0dRx0sc/WG2OV5hmTnGhep 0JyA== X-Gm-Message-State: ALoCoQmd24ozRaiVxsVqrFEd330Mxwl0GHXUC48x9lvnWTYZXC8PVCyry0EIPF9VtzvqbeBLC0Cb X-Received: by 10.112.171.74 with SMTP id as10mr64864lbc.8.1420177635328; Thu, 01 Jan 2015 21:47:15 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.19.130 with SMTP id f2ls2236766lae.21.gmail; Thu, 01 Jan 2015 21:47:15 -0800 (PST) X-Received: by 10.153.4.44 with SMTP id cb12mr66276207lad.30.1420177634988; Thu, 01 Jan 2015 21:47:14 -0800 (PST) Received: from mail-la0-f50.google.com (mail-la0-f50.google.com. [209.85.215.50]) by mx.google.com with ESMTPS id d5si9421865lab.63.2015.01.01.21.47.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 01 Jan 2015 21:47:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 as permitted sender) client-ip=209.85.215.50; Received: by mail-la0-f50.google.com with SMTP id pn19so15000866lab.23 for ; Thu, 01 Jan 2015 21:47:14 -0800 (PST) X-Received: by 10.152.87.12 with SMTP id t12mr74762816laz.31.1420177634587; Thu, 01 Jan 2015 21:47:14 -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.9.200 with SMTP id c8csp114430lbb; Thu, 1 Jan 2015 21:47:13 -0800 (PST) X-Received: by 10.70.62.9 with SMTP id u9mr115280810pdr.156.1420177632523; Thu, 01 Jan 2015 21:47:12 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t3si68097479pdc.177.2015.01.01.21.47.11; Thu, 01 Jan 2015 21:47:12 -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 S1750712AbbABFrK (ORCPT + 12 others); Fri, 2 Jan 2015 00:47:10 -0500 Received: from mail-pd0-f181.google.com ([209.85.192.181]:42345 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750702AbbABFrJ (ORCPT ); Fri, 2 Jan 2015 00:47:09 -0500 Received: by mail-pd0-f181.google.com with SMTP id v10so23188641pde.12 for ; Thu, 01 Jan 2015 21:47:09 -0800 (PST) X-Received: by 10.70.41.2 with SMTP id b2mr119670502pdl.62.1420177629205; Thu, 01 Jan 2015 21:47:09 -0800 (PST) Received: from localhost ([122.167.116.151]) by mx.google.com with ESMTPSA id k3sm45460080pdj.2.2015.01.01.21.47.08 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 01 Jan 2015 21:47:08 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, prarit@redhat.com, skannan@codeaurora.org, Viresh Kumar Subject: [PATCH V2 02/14] cpufreq: stats: return -EEXIST when stats are already allocated Date: Fri, 2 Jan 2015 11:16:39 +0530 Message-Id: <85e5b1e6e871fdd8e7a80bba310a7b2948b52917.1420177186.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.2.0 In-Reply-To: References: In-Reply-To: References: 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=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.215.50 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: , List-Help: , List-Archive: List-Unsubscribe: , __cpufreq_stats_create_table() is called from: - policy create notifier: stats will always be NULL here - cpufreq_stats_init() calls it for all CPUs as cpufreq-stats can be initialized after cpufreq driver. Because CPUs share clock lines, 'stats' will be NULL here for the first cpu only and will return back for others. While we return for other CPUs, we don't return the right error value. We must return -EEXIST, as that is the case here. Reviewed-by: Prarit Bhargava Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq_stats.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/cpufreq/cpufreq_stats.c b/drivers/cpufreq/cpufreq_stats.c index 81be4d637ab4..403671b1a5ee 100644 --- a/drivers/cpufreq/cpufreq_stats.c +++ b/drivers/cpufreq/cpufreq_stats.c @@ -192,8 +192,10 @@ static int __cpufreq_stats_create_table(struct cpufreq_policy *policy) if (unlikely(!table)) return 0; + /* stats already initialized */ if (per_cpu(cpufreq_stats_table, cpu)) - return -EBUSY; + return -EEXIST; + stat = kzalloc(sizeof(*stat), GFP_KERNEL); if ((stat) == NULL) return -ENOMEM;