From patchwork Wed Jul 22 08:30:38 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dasgupta, Romit" X-Patchwork-Id: 36721 Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n6M8UrOY008804 for ; Wed, 22 Jul 2009 08:30:53 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755810AbZGVIav (ORCPT ); Wed, 22 Jul 2009 04:30:51 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1755801AbZGVIav (ORCPT ); Wed, 22 Jul 2009 04:30:51 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:52767 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754619AbZGVIau convert rfc822-to-8bit (ORCPT ); Wed, 22 Jul 2009 04:30:50 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6M8UgQb009891; Wed, 22 Jul 2009 03:30:48 -0500 Received: from dbde71.ent.ti.com (localhost [127.0.0.1]) by dbdp20.itg.ti.com (8.13.8/8.13.8) with ESMTP id n6M8UeMJ002630; Wed, 22 Jul 2009 14:00:41 +0530 (IST) Received: from dbde02.ent.ti.com ([172.24.170.145]) by dbde71.ent.ti.com ([172.24.170.149]) with mapi; Wed, 22 Jul 2009 14:00:40 +0530 From: "Dasgupta, Romit" To: Kevin Hilman CC: "linux-omap@vger.kernel.org Mailing List" , "sameo@linux.intel.com" Date: Wed, 22 Jul 2009 14:00:38 +0530 Subject: [PATCH] mfd: twl: Fix possible NULL pointer violation Thread-Topic: [PATCH] mfd: twl: Fix possible NULL pointer violation Thread-Index: AcoKpI2rjATEhZfGRS+M3U3VIcWvegAAft1w Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org Missed some formatting earlier. Fixes a possible NULL pointer violation. Tested on 3430 SDP. Signed-off-by: Romit Dasgupta --- >-----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 >--- > >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 --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))