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: 1294481 Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 854653FCFC for ; Wed, 8 Aug 2012 11:30:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756099Ab2HHLad (ORCPT ); Wed, 8 Aug 2012 07:30:33 -0400 Received: from na3sys009aog126.obsmtp.com ([74.125.149.155]:44556 "EHLO na3sys009aog126.obsmtp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754615Ab2HHLac (ORCPT ); Wed, 8 Aug 2012 07:30:32 -0400 Received: from mail-gh0-f172.google.com ([209.85.160.172]) (using TLSv1) by na3sys009aob126.postini.com ([74.125.148.12]) with SMTP ID DSNKUCJN16yGlHLT//IE9cu2YQy4IwiNlbcP@postini.com; Wed, 08 Aug 2012 04:30:32 PDT Received: by ghbg16 with SMTP id g16so809836ghb.17 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=TYiK7f+W609q/YkEyaem9wCk9O5E6f6J/1wX4c5E2NCqBMO+lTpobRT8lK6eBrZb0f Fa0KFJKUAkDbVaFgSG7qPkOP3ZQj4whQUFpAPPCd7eD68niVrDHnM3efdazFcZf+GP9T VEzthyuitOYlcE9hIwd5g6P+iXyeygb5tpOad0FuP4yUEwcweNoU2AjIJfsBo1r1TS2O YPZNa9uDtcc4xSwX0s9RPQYKLAshJ+w56FTVloE9DgeHltDbgM9K7Tz7rPPv2qVNlH+m 9fj8rDHunsmm8khFtSgVlUTmz/koCVsV2sTRXGXRoC4tIZcpOcE5KGmVsIE09I0SwRHr rkkA== 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: ALoCoQkuIZ3VaF6edXn1nT2CdUJtH3LqEs7PgOavutMDD9HVFeTR2alCP23FriGIqljNqbhWq3/f Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@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-pm" 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;