diff mbox

mfd: twl: Fix possible NULL pointer violation

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

Commit Message

Dasgupta, Romit July 22, 2009, 8:30 a.m. UTC
Missed some formatting earlier.

Fixes a possible NULL pointer violation. Tested on 3430 SDP.
Signed-off-by: Romit Dasgupta <romit@ti.com>
---


>-----Original Message-----
>From: linux-omap-owner@vger.kernel.org [mailto:linux-omap-
>owner@vger.kernel.org] On Behalf Of Dasgupta, Romit
>Sent: Wednesday, July 22, 2009 1:45 PM
>To: Kevin Hilman
>Cc: linux-omap@vger.kernel.org Mailing List; sameo@linux.intel.com
>Subject: [PATCH] mfd: twl: Fix possible NULL pointer violation
>
>Fixes a possible NULL pointer violation. Tested on SDP 3430.
>
>Signed-off-by: Romit Dasgupta <romit@ti.com>
>---
>
>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))
>--
>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

--
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..e050a5e 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) {
-			twl4030_configure_resource(resconfig);
-			resconfig++;
-		}
+	while (resconfig && resconfig->resource) {
+		twl4030_configure_resource(resconfig);
+		resconfig++;
 	}
 
 	if (twl4030_i2c_write_u8(TWL4030_MODULE_PM_MASTER, 0, R_PROTECT_KEY))