From patchwork Mon Apr 27 16:26:25 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Phil Carmody X-Patchwork-Id: 20188 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 n3RGQbP8003543 for ; Mon, 27 Apr 2009 16:26:38 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755529AbZD0Q0f (ORCPT ); Mon, 27 Apr 2009 12:26:35 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755768AbZD0Q0f (ORCPT ); Mon, 27 Apr 2009 12:26:35 -0400 Received: from smtp.nokia.com ([192.100.105.134]:32599 "EHLO mgw-mx09.nokia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755529AbZD0Q0f (ORCPT ); Mon, 27 Apr 2009 12:26:35 -0400 Received: from vaebh106.NOE.Nokia.com (vaebh106.europe.nokia.com [10.160.244.32]) by mgw-mx09.nokia.com (Switch-3.2.6/Switch-3.2.6) with ESMTP id n3RGPmka020784 for ; Mon, 27 Apr 2009 11:26:35 -0500 Received: from esebh102.NOE.Nokia.com ([172.21.138.183]) by vaebh106.NOE.Nokia.com with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Apr 2009 19:25:47 +0300 Received: from mgw-int02.ntc.nokia.com ([172.21.143.97]) by esebh102.NOE.Nokia.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.3959); Mon, 27 Apr 2009 19:25:46 +0300 Received: from localhost.localdomain (esdhcp04266.research.nokia.com [172.21.42.66]) by mgw-int02.ntc.nokia.com (Switch-3.2.5/Switch-3.2.5) with ESMTP id n3RGPhGY021911; Mon, 27 Apr 2009 19:25:45 +0300 From: Phil Carmody To: linux-omap@vger.kernel.org Cc: Phil Carmody Subject: [PATCH 2/2] OMAP3: PM: Early exit on invalid parameters Date: Mon, 27 Apr 2009 19:26:25 +0300 Message-Id: <7ae7ea307c1097671e8637c8d3d43e3e7fefec54.1240849197.git.ext-phil.2.carmody@nokia.com> X-Mailer: git-send-email 1.5.4.3 In-Reply-To: <9ba9fdeeec0cd47fdcff6b689d2196665ea8bcbf.1240849197.git.ext-phil.2.carmody@nokia.com> References: <> <1240849585-14828-1-git-send-email-ext-phil.2.carmody@nokia.com> <9ba9fdeeec0cd47fdcff6b689d2196665ea8bcbf.1240849197.git.ext-phil.2.carmody@nokia.com> In-Reply-To: <9ba9fdeeec0cd47fdcff6b689d2196665ea8bcbf.1240849197.git.ext-phil.2.carmody@nokia.com> References: <9ba9fdeeec0cd47fdcff6b689d2196665ea8bcbf.1240849197.git.ext-phil.2.carmody@nokia.com> X-OriginalArrivalTime: 27 Apr 2009 16:25:46.0914 (UTC) FILETIME=[D1E11820:01C9C754] X-Nokia-AV: Clean Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Phil Carmody Currently no clients call with invalid parameters, but as these are exported functions there ought to be some protection against what would cause NULL pointer dereferences. Signed-off-by: Phil Carmody --- arch/arm/mach-omap2/smartreflex.c | 8 ++++++++ 1 files changed, 8 insertions(+), 0 deletions(-) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index ce7d436..741b51e 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -555,6 +555,8 @@ void sr_start_vddautocomap(int srid, u32 target_opp_no) sr = &sr1; else if (srid == SR2) sr = &sr2; + else + return; if (sr->is_sr_reset == 1) { sr_clk_enable(sr); @@ -583,6 +585,8 @@ int sr_stop_vddautocomap(int srid) sr = &sr1; else if (srid == SR2) sr = &sr2; + else + return -EINVAL; if (sr->is_autocomp_active == 1) { sr_disable(sr); @@ -609,6 +613,8 @@ void enable_smartreflex(int srid) sr = &sr1; else if (srid == SR2) sr = &sr2; + else + return; if (sr->is_autocomp_active == 1) { if (sr->is_sr_reset == 1) { @@ -636,6 +642,8 @@ void disable_smartreflex(int srid) sr = &sr1; else if (srid == SR2) sr = &sr2; + else + return; if (sr->is_autocomp_active == 1) { if (sr->is_sr_reset == 0) {