Skip to contentSkip to conversation

OMAP3: PM: Do not Enable SmartReflex if OPP tables not defined

PATCH In review Roger Quadros 2 participants 2 messages May 19, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 OMAP3: PM: Do not Enable SmartReflex if OPP tables not defined

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.

---
 arch/arm/mach-omap2/smartreflex.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/smartreflex.c +6 -0
index b032366..4823ce8 100644
@@ -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);
Signature · 1 line
1.6.0.4
#1 lore raw
Quoted 5 lines · Roger Quadros

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.

Thanks, pushing to PM branch.

Kevin

Quoted 23 lines
---
 arch/arm/mach-omap2/smartreflex.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
arch/arm/mach-omap2/smartreflex.c +6 -0
index b032366..4823ce8 100644
@@ -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);
Signature · 1 line
1.6.0.4