[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <1264625001-3963-1-git-send-email-broonie@opensource.wolfsonmicro.com>
Date: Wed, 27 Jan 2010 20:43:21 +0000
From: Mark Brown <broonie@...nsource.wolfsonmicro.com>
To: Anton Vorontsov <avorontsov@...mvista.com>
Cc: Marek Vasut <marek.vasut@...il.com>, linux-kernel@...r.kernel.org,
Mark Brown <broonie@...nsource.wolfsonmicro.com>
Subject: [PATCH 2.6.33] power_supply: Handle missing platform data gracefully
Don't unconditionally dereference the WM97xx core platform data since
it may not be present, causing an oops.
Signed-off-by: Mark Brown <broonie@...nsource.wolfsonmicro.com>
---
drivers/power/wm97xx_battery.c | 10 ++++++++--
1 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/power/wm97xx_battery.c b/drivers/power/wm97xx_battery.c
index fa39e75..6ea3cb5 100644
--- a/drivers/power/wm97xx_battery.c
+++ b/drivers/power/wm97xx_battery.c
@@ -175,8 +175,14 @@ static int __devinit wm97xx_bat_probe(struct platform_device *dev)
dev_err(&dev->dev, "Do not pass platform_data through "
"wm97xx_bat_set_pdata!\n");
return -EINVAL;
- } else
- pdata = wmdata->batt_pdata;
+ }
+
+ if (!wmdata) {
+ dev_err(&dev->dev, "No platform data supplied\n");
+ return -EINVAL;
+ }
+
+ pdata = wmdata->batt_pdata;
if (dev->id != -1)
return -EINVAL;
--
1.6.6
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists