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

Commit 1602c69b authored by Aviral Gupta's avatar Aviral Gupta
Browse files

ASoC: wcd9306: fix the NULL pointer dereference in the tapan codec



During the close of the AFE port the AIF1 PB widget will be closed
which access the core variable.
If the core is not initialized yet it will result in the kernel panic.
Fix by adding the check for the core structure to be initialized.

CRs-Fixed: 635790
Change-Id: Ic057e2eb75b25dbc55aa06cbce2b49aca0b1b25f
Signed-off-by: default avatarAviral Gupta <aviralg@codeaurora.org>
parent 458bbce8
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -4182,6 +4182,12 @@ static int tapan_codec_enable_slimrx(struct snd_soc_dapm_widget *w,

	core = dev_get_drvdata(codec->dev->parent);

	if (core == NULL) {
		dev_err(codec->dev, "%s: core is null\n",
				__func__);
		return -EINVAL;
	}

	dev_dbg(codec->dev, "%s: event called! codec name %s\n",
		__func__, w->codec->name);
	dev_dbg(codec->dev, "%s: num_dai %d stream name %s event %d\n",