Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -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)