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

Commit 5055f775 authored by Phani Kumar Uppalapati's avatar Phani Kumar Uppalapati
Browse files

ASoC: wcd9xxx: check NULL pointer access for wcd9xxx



It may be possible that device up gets called
before slim probe and this leads to NULL pointer
access. Avoid the NULL pointer access before
processing device up.

Change-Id: Ie698b1b60099afdb26b9e723916630f9b2b97221
Signed-off-by: default avatarPhani Kumar Uppalapati <phaniu@codeaurora.org>
parent 86155e46
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1689,6 +1689,10 @@ static int wcd9xxx_device_up(struct wcd9xxx *wcd9xxx)
static int wcd9xxx_slim_device_up(struct slim_device *sldev)
{
	struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);
	if (!wcd9xxx) {
		pr_err("%s: wcd9xxx is NULL\n", __func__);
		return -EINVAL;
	}
	dev_dbg(wcd9xxx->dev, "%s: device up\n", __func__);
	return wcd9xxx_device_up(wcd9xxx);
}
@@ -1697,6 +1701,10 @@ static int wcd9xxx_slim_device_down(struct slim_device *sldev)
{
	struct wcd9xxx *wcd9xxx = slim_get_devicedata(sldev);

	if (!wcd9xxx) {
		pr_err("%s: wcd9xxx is NULL\n", __func__);
		return -EINVAL;
	}
	wcd9xxx_irq_exit(&wcd9xxx->core_res);
	if (wcd9xxx->dev_down)
		wcd9xxx->dev_down(wcd9xxx);