From d3293b150429bf5d642be324bfe96f5404f77d5e Mon Sep 17 00:00:00 2001 From: Phil Carmody Date: Mon, 27 Apr 2009 19:26:25 +0300 Subject: [PATCH] OMAP3: PM: Early exit on invalid parameters 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 file changed, 8 insertions(+) diff --git a/arch/arm/mach-omap2/smartreflex.c b/arch/arm/mach-omap2/smartreflex.c index aa765834032..aa9b8f95811 100644 --- a/arch/arm/mach-omap2/smartreflex.c +++ b/arch/arm/mach-omap2/smartreflex.c @@ -574,6 +574,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); @@ -602,6 +604,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); @@ -628,6 +632,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) { @@ -660,6 +666,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) { -- 2.11.4.GIT