mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-08-26 19:00:25 +00:00
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:
parent
be8cde8b24
commit
12b336a8b4
1 changed files with 8 additions and 2 deletions
|
@ -175,7 +175,13 @@ 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
|
||||
}
|
||||
|
||||
if (!wmdata) {
|
||||
dev_err(&dev->dev, "No platform data supplied\n");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
pdata = wmdata->batt_pdata;
|
||||
|
||||
if (dev->id != -1)
|
||||
|
|
Loading…
Reference in a new issue