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>
This commit is contained in:
Mark Brown 2010-01-27 20:43:21 +00:00 коммит произвёл Anton Vorontsov
Родитель be8cde8b24
Коммит 12b336a8b4
1 изменённых файлов: 8 добавлений и 2 удалений

Просмотреть файл

@ -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;