public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] OMAP3: PM: Fix Smartreflex when used with PM_NOOP layer
@ 2009-05-15 11:55 Roger Quadros
  2009-05-15 14:54 ` Kevin Hilman
  0 siblings, 1 reply; 2+ messages in thread
From: Roger Quadros @ 2009-05-15 11:55 UTC (permalink / raw)
  To: khilman; +Cc: linux-omap, ext-phil.2.carmody

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 <ext-roger.quadros@nokia.com>
---
 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;
-- 
1.6.0.4


^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2009-05-15 14:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-05-15 11:55 [PATCH] OMAP3: PM: Fix Smartreflex when used with PM_NOOP layer Roger Quadros
2009-05-15 14:54 ` Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox