Commit 12b336a8 authored by Mark Brown's avatar Mark Brown Committed by Anton Vorontsov

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: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: default avatarAnton Vorontsov <avorontsov@ru.mvista.com>
parent be8cde8b
......@@ -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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment