From patchwork Wed Aug 8 11:30:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Santosh Shilimkar X-Patchwork-Id: 1294491 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id BF12EDF223 for ; Wed, 8 Aug 2012 11:30:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756326Ab2HHLad (ORCPT ); Wed, 8 Aug 2012 07:30:33 -0400 Received: from na3sys009aog134.obsmtp.com ([74.125.149.83]:57925 "EHLO na3sys009aog134.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755968Ab2HHLac (ORCPT ); Wed, 8 Aug 2012 07:30:32 -0400 Received: from mail-gg0-f172.google.com ([209.85.161.172]) (using TLSv1) by na3sys009aob134.postini.com ([74.125.148.12]) with SMTP ID DSNKUCJN16yGlHLT//IE9cu2YQy4IwiNlbcP@postini.com; Wed, 08 Aug 2012 04:30:32 PDT Received: by ggnc4 with SMTP id c4so705349ggn.31 for ; Wed, 08 Aug 2012 04:30:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:x-gm-message-state; bh=f2kvA4jZ2eqzIPPsQja6qDgtJwOKLaAuSgX/mJ9GMOY=; b=dDV3St+PoMBTj46LbtdXrmUdeXG/Hc5lGdpmU2huqM1SFBEmZqSETzr7m9+II7EBFa 30VxegHQCaeqJJxy3Kzr3yYn0h5CLoSVulzAbMg5hgDOq5Ngw92MAYJ6ATaYv8i9RU7m 2ojGM2O3O6vSmjVijw1gY/i0dJQr7esJfeHqwTLyj2gAZwKDQmnB0oDFVs4v8UqtRAhz 9AaDJxTBCVD+iHlCHNTbRwgBrGxCgUTnkcfIH1fUV+hELt/WasKAOxUyN0iJkaNrWzjP q2JKvoxbvYcWk8/SOjKJo4rMj/0WzHJbHvCEjXbRsOACa1ryFW5C0bZ4co1Rg8puLvp4 BrWw== Received: by 10.42.23.207 with SMTP id t15mr13882036icb.3.1344425430634; Wed, 08 Aug 2012 04:30:30 -0700 (PDT) MIME-Version: 1.0 Received: by 10.231.65.85 with HTTP; Wed, 8 Aug 2012 04:30:10 -0700 (PDT) In-Reply-To: <1344423254-3475-2-git-send-email-rnayak@ti.com> References: <1344423254-3475-1-git-send-email-rnayak@ti.com> <1344423254-3475-2-git-send-email-rnayak@ti.com> From: "Shilimkar, Santosh" Date: Wed, 8 Aug 2012 17:00:10 +0530 Message-ID: Subject: Re: [PATCH 1/2] cpufreq: OMAP: Handle missing frequency table on SMP systems To: Rajendra Nayak Cc: khilman@ti.com, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org X-Gm-Message-State: ALoCoQkSHtqQR0gOCbTSa2MX54XenJ6ZMN949Mq1IPkY6naNAo9qy9snMbwpQUu7WuM9IA2/fyWH Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org On Wed, Aug 8, 2012 at 4:24 PM, Rajendra Nayak wrote: > > On OMAP4, if the first CPU fails to get a valid frequency table (this > could happen if the platform does not register any OPP table), the > subsequent CPU instances end up dealing with a NULL freq_table and > crash. Add a check for a NULL freq_table to help error the rest > of the CPU instances out. > > Signed-off-by: Rajendra Nayak > Cc: > --- > drivers/cpufreq/omap-cpufreq.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/cpufreq/omap-cpufreq.c > b/drivers/cpufreq/omap-cpufreq.c > index 17fa04d..0ee824c 100644 > --- a/drivers/cpufreq/omap-cpufreq.c > +++ b/drivers/cpufreq/omap-cpufreq.c > @@ -221,7 +221,7 @@ static int __cpuinit omap_cpu_init(struct > cpufreq_policy *policy) > if (atomic_inc_return(&freq_table_users) == 1) > result = opp_init_cpufreq_table(mpu_dev, &freq_table); > > - if (result) { > + if (result || !freq_table) { > dev_err(mpu_dev, "%s: cpu%d: failed creating freq > table[%d]\n", > __func__, policy->cpu, result); > goto fail_ck; The freq_table use count seems to be buggy in that case. Something like below should fix the issue. Feel free to update your patch with below if you agree. --- To unsubscribe from this list: send the line "unsubscribe linux-omap" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c index 17fa04d..fd97c3d 100644 --- a/drivers/cpufreq/omap-cpufreq.c +++ b/drivers/cpufreq/omap-cpufreq.c @@ -218,7 +218,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *po policy->cur = policy->min = policy->max = omap_getspeed(policy->cpu); - if (atomic_inc_return(&freq_table_users) == 1) + if (freq_table) result = opp_init_cpufreq_table(mpu_dev, &freq_table); if (result) { @@ -227,6 +227,7 @@ static int __cpuinit omap_cpu_init(struct cpufreq_policy *po goto fail_ck; } + atomic_inc_return(&freq_table_users); result = cpufreq_frequency_table_cpuinfo(policy, freq_table); if (result) goto fail_table;