From patchwork Tue May 19 12:37:51 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 24706 X-Patchwork-Delegate: khilman@deeprootsystems.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n4JCeLHC023488 for ; Tue, 19 May 2009 12:40:21 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751790AbZESMkQ (ORCPT ); Tue, 19 May 2009 08:40:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752189AbZESMkQ (ORCPT ); Tue, 19 May 2009 08:40:16 -0400 Received: from smtp.nokia.com ([192.100.122.230]:63195 "EHLO mgw-mx03.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751790AbZESMkP (ORCPT ); Tue, 19 May 2009 08:40:15 -0400 Received: from esebh106.NOE.Nokia.com (esebh106.ntc.nokia.com [172.21.138.213]) by mgw-mx03.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n4JCdqig002057; Tue, 19 May 2009 15:40:11 +0300 Received: from vaebh104.NOE.Nokia.com ([10.160.244.30]) by esebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 May 2009 15:38:32 +0300 Received: from mgw-da01.ext.nokia.com ([147.243.128.24]) by vaebh104.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Tue, 19 May 2009 15:38:31 +0300 Received: from localhost.localdomain (esdhcp039131.research.nokia.com [172.21.39.131]) by mgw-da01.ext.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n4JCcQXS010726; Tue, 19 May 2009 15:38:27 +0300 From: Roger Quadros To: khilman@deeprootsystems.com Cc: linux-omap@vger.kernel.org Subject: [PATCH] OMAP3: PM: Do not Enable SmartReflex if OPP tables not defined Date: Tue, 19 May 2009 15:37:51 +0300 Message-Id: <1242736671-27268-1-git-send-email-ext-roger.quadros@nokia.com> X-Mailer: git-send-email 1.6.0.4 X-OriginalArrivalTime: 19 May 2009 12:38:31.0733 (UTC) FILETIME=[B7C41650:01C9D87E] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Prevent SmartReflex driver driver from loading if OPP tables are not defined by platform. This removes possibility of NULL pointer reference in SmartReflex driver code. Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/smartreflex.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index b032366..4823ce8 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -852,6 +852,12 @@ static int __init omap3_sr_init(void) int ret = 0; u8 RdReg; + /* Exit if OPP tables are not defined */ + if (!(mpu_opps && l3_opps)) { + pr_err("SR: OPP rate tables not defined for platform, not enabling SmartReflex\n"); + return -ENODEV; + } + /* Enable SR on T2 */ ret = twl4030_i2c_read_u8(TWL4030_MODULE_PM_RECEIVER, &RdReg, R_DCDC_GLOBAL_CFG);