From patchwork Wed Jul 22 08:15:20 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Dasgupta, Romit" X-Patchwork-Id: 36718 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 n6M8FZqd006769 for ; Wed, 22 Jul 2009 08:15:36 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755968AbZGVIPd (ORCPT ); Wed, 22 Jul 2009 04:15:33 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756002AbZGVIPd (ORCPT ); Wed, 22 Jul 2009 04:15:33 -0400 Received: from comal.ext.ti.com ([198.47.26.152]:42821 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755968AbZGVIPc convert rfc822-to-8bit (ORCPT ); Wed, 22 Jul 2009 04:15:32 -0400 Received: from dbdp20.itg.ti.com ([172.24.170.38]) by comal.ext.ti.com (8.13.7/8.13.7) with ESMTP id n6M8FPtk000602; Wed, 22 Jul 2009 03:15:31 -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 n6M8FMPW022567; Wed, 22 Jul 2009 13:45:23 +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 13:45:22 +0530 From: "Dasgupta, Romit" To: Kevin Hilman CC: "linux-omap@vger.kernel.org Mailing List" , "sameo@linux.intel.com" Date: Wed, 22 Jul 2009 13:45:20 +0530 Subject: [PATCH] mfd: twl: Fix possible NULL pointer violation Thread-Topic: [PATCH] mfd: twl: Fix possible NULL pointer violation Thread-Index: AcoKpI2rjATEhZfGRS+M3U3VIcWveg== Message-ID: 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 Fixes a possible NULL pointer violation. Tested on SDP 3430. Signed-off-by: Romit Dasgupta --- -- 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..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))