[PATCH] mfd: twl: Fix possible NULL pointer violation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Missed some formatting earlier.

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

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))

>-----Original Message-----
>From: linux-omap-owner@xxxxxxxxxxxxxxx [mailto:linux-omap-
>owner@xxxxxxxxxxxxxxx] On Behalf Of Dasgupta, Romit
>Sent: Wednesday, July 22, 2009 1:45 PM
>To: Kevin Hilman
>Cc: linux-omap@xxxxxxxxxxxxxxx Mailing List; sameo@xxxxxxxxxxxxxxx
>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@xxxxxx>
>---
>
>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@xxxxxxxxxxxxxxx
>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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Arm (vger)]     [ARM Kernel]     [ARM MSM]     [Linux Tegra]     [Linux WPAN Networking]     [Linux Wireless Networking]     [Maemo Users]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Trails]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux