diff mbox

mfd: twl: Fix possible NULL pointer violation

Message ID B85A65D85D7EB246BE421B3FB0FBB59301D88D7CA2@dbde02.ent.ti.com (mailing list archive)
State Awaiting Upstream, archived
Headers show

Commit Message

Dasgupta, Romit July 22, 2009, 8:15 a.m. UTC
Fixes a possible NULL pointer violation. Tested on SDP 3430.

Signed-off-by: Romit Dasgupta <romit@ti.com>
---

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mfd/twl4030-power.c b/drivers/mfd/twl4030-power.c
index 07e40dc..fd5504c 100644
--- a/drivers/mfd/twl4030-power.c
+++ b/drivers/mfd/twl4030-power.c
@@ -352,11 +352,9 @@  void __init twl4030_power_init(struct twl4030_power_data *triton2_scripts)
 	}
 
 	resconfig = triton2_scripts->resource_config;
-	if (resconfig) {
-		while (resconfig->resource) {
+	while (resconfig && resconfig->resource) {
 			twl4030_configure_resource(resconfig);
 			resconfig++;
-		}
 	}
 
 	if (twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY))