From patchwork Fri May 15 11:55:47 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 24043 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 n4FBwGU6004134 for ; Fri, 15 May 2009 11:58:17 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753198AbZEOL53 (ORCPT ); Fri, 15 May 2009 07:57:29 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1754890AbZEOL53 (ORCPT ); Fri, 15 May 2009 07:57:29 -0400 Received: from smtp.nokia.com ([192.100.105.134]:54764 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753198AbZEOL52 (ORCPT ); Fri, 15 May 2009 07:57:28 -0400 Received: from vaebh105.NOE.Nokia.com (vaebh105.europe.nokia.com [10.160.244.31]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n4FBuvkc014432; Fri, 15 May 2009 06:57:28 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh105.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Fri, 15 May 2009 14:56:29 +0300 Received: from mgw-int01.ntc.nokia.com ([172.21.143.96]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Fri, 15 May 2009 14:56:28 +0300 Received: from localhost.localdomain (esdhcp037157.research.nokia.com [172.21.37.157]) by mgw-int01.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n4FBuQYV012528; Fri, 15 May 2009 14:56:27 +0300 From: Roger Quadros To: khilman@deeprootsystems.com Cc: linux-omap@vger.kernel.org, ext-phil.2.carmody@nokia.com Subject: [PATCH] OMAP3: PM: Fix Smartreflex when used with PM_NOOP layer Date: Fri, 15 May 2009 14:55:47 +0300 Message-Id: <1242388547-4241-1-git-send-email-ext-roger.quadros@nokia.com> X-Mailer: git-send-email 1.6.0.4 X-OriginalArrivalTime: 15 May 2009 11:56:28.0560 (UTC) FILETIME=[2E2F7100:01C9D554] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org omap_pm_vddX_get_opp() returns 0 if PM layer is PM_NOOP or PM_NONE. This is not a valid OPP so we must sanity check this correctly before using. This patch fixes system lockup when we enable smartreflex "echo 1 > /sys/power/sr_vdd1_autocomp" Signed-off-by: Roger Quadros --- arch/arm/mach-omap2/smartreflex.c | 12 ++++++++---- 1 files changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index 42e16a6..b032366 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -787,8 +787,10 @@ static ssize_t omap_sr_vdd1_autocomp_store(struct kobject *kobj, sr_stop_vddautocomap(SR1); } else { u32 current_vdd1opp_no = omap_pm_vdd1_get_opp(); - if (IS_ERR_VALUE(current_vdd1opp_no)) - return -ENODEV; + if (!current_vdd1opp_no) { + pr_err("sr_vdd1_autocomp: Current VDD1 opp unknown\n"); + return -EINVAL; + } sr_start_vddautocomap(SR1, current_vdd1opp_no); } return n; @@ -825,8 +827,10 @@ static ssize_t omap_sr_vdd2_autocomp_store(struct kobject *kobj, sr_stop_vddautocomap(SR2); } else { u32 current_vdd2opp_no = omap_pm_vdd2_get_opp(); - if (IS_ERR_VALUE(current_vdd2opp_no)) - return -ENODEV; + if (!current_vdd2opp_no) { + pr_err("sr_vdd2_autocomp: Current VDD2 opp unknown\n"); + return -EINVAL; + } sr_start_vddautocomap(SR2, current_vdd2opp_no); } return n;