From patchwork Thu Dec 18 12:00:19 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 42430 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 7005926C8B for ; Thu, 18 Dec 2014 12:01:15 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf768972eek.5 for ; Thu, 18 Dec 2014 04:01:14 -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=6YWuandfpgIpZdlgdIztkVjdfhGRHq5Fgr0g4rSpd7o=; b=DKAWO7c+QuaAdNmWmM7gKnHTDZG0esYUyz3HoIDEZCGy5opkN4bzoyjkabScUZk+8a DrUgYJhNfntUXhf8qCKMpYDBcxfUcGIbgUwcZ94w/9zgjc3HxiWNlY/qF49c4nltlCaT uGU9bqToRpXU4MABr+n8x190VkNw5W0GFfR+/mKiTZnYLgmo9R3VTI09dU9iHz43Digs oqHwcwT8UKwSDBJYA/wgvOb/WvZRdDb7FSOVCS1DFIagGnReHyRQZYEJQSSpJlOcSTy0 OGj13RiTOVIuRrCnmid+pDAq0NVFoOLMc724x8mjikEIskkcUTcmD2hjrk8Xi//7Vids nReA== X-Gm-Message-State: ALoCoQkFtQfJsHjLS+JxsKGO7y7cLVcFOPvWJkDKNrqFt6+qy51RtP3zSUFjKCBEjj/+j6Erk0SY X-Received: by 10.194.178.163 with SMTP id cz3mr280936wjc.1.1418904074660; Thu, 18 Dec 2014 04:01:14 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.152.1.229 with SMTP id 5ls10437lap.55.gmail; Thu, 18 Dec 2014 04:01:14 -0800 (PST) X-Received: by 10.152.87.67 with SMTP id v3mr1747852laz.97.1418904074307; Thu, 18 Dec 2014 04:01:14 -0800 (PST) Received: from mail-lb0-f172.google.com (mail-lb0-f172.google.com. [209.85.217.172]) by mx.google.com with ESMTPS id xs7si6690721lbb.34.2014.12.18.04.01.14 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:01:14 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.172 as permitted sender) client-ip=209.85.217.172; Received: by mail-lb0-f172.google.com with SMTP id u10so824354lbd.31 for ; Thu, 18 Dec 2014 04:01:14 -0800 (PST) X-Received: by 10.152.87.100 with SMTP id w4mr1807260laz.71.1418904074156; Thu, 18 Dec 2014 04:01: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.142.69 with SMTP id ru5csp1680347lbb; Thu, 18 Dec 2014 04:01:13 -0800 (PST) X-Received: by 10.66.157.137 with SMTP id wm9mr2736265pab.17.1418904072112; Thu, 18 Dec 2014 04:01:12 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ov3si9608661pbc.228.2014.12.18.04.01.11; Thu, 18 Dec 2014 04:01: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 S1752457AbaLRMBK (ORCPT + 12 others); Thu, 18 Dec 2014 07:01:10 -0500 Received: from mail-pd0-f181.google.com ([209.85.192.181]:64623 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752450AbaLRMBJ (ORCPT ); Thu, 18 Dec 2014 07:01:09 -0500 Received: by mail-pd0-f181.google.com with SMTP id v10so1285815pde.40 for ; Thu, 18 Dec 2014 04:01:09 -0800 (PST) X-Received: by 10.70.50.228 with SMTP id f4mr2682662pdo.27.1418904068986; Thu, 18 Dec 2014 04:01:08 -0800 (PST) Received: from localhost ([122.166.148.73]) by mx.google.com with ESMTPSA id u4sm6609239pbs.60.2014.12.18.04.01.07 (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 18 Dec 2014 04:01:08 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, Viresh Kumar Subject: [PATCH 02/13] cpufreq: stats: return -EEXIST when stats are already allocated Date: Thu, 18 Dec 2014 17:30:19 +0530 Message-Id: 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.217.172 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. 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;