diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2010-01-27 21:43:21 +0100 |
---|---|---|
committer | Anton Vorontsov <avorontsov@ru.mvista.com> | 2010-01-29 15:00:18 +0100 |
commit | 12b336a8b4ea8652372f88521bf55cef7f5d5283 (patch) | |
tree | 81f448a4c122a03c2d52d95a838e5f8af4e12693 /drivers/power | |
parent | Merge git://git.kernel.org/pub/scm/linux/kernel/git/jejb/scsi-rc-fixes-2.6 (diff) | |
download | linux-12b336a8b4ea8652372f88521bf55cef7f5d5283.tar.xz linux-12b336a8b4ea8652372f88521bf55cef7f5d5283.zip |
wm97xx_battery: 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@opensource.wolfsonmicro.com>
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | 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 fa39e759a275..6ea3cb5837c7 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; |