ASoC: msm: fix the target crash due to the NULL pointer dereference

During the close of the FE, the mclk is disabled which accesses the
codec drv data.
In case if the tapan codec was not initialized, then close sequence
will result in the null pointer dereference.
Fix by adding a null check before accessing the codec data structure.

CRs-Fixed: 635065
Change-Id: I0678826d073a69b99a05a5b628920be89d210519
Signed-off-by: Aviral Gupta <aviralg@codeaurora.org>
diff --git a/sound/soc/codecs/wcd9306.c b/sound/soc/codecs/wcd9306.c
index f59456e..fccb70c 100644
--- a/sound/soc/codecs/wcd9306.c
+++ b/sound/soc/codecs/wcd9306.c
@@ -5786,7 +5786,17 @@
 	const char *name)
 {
 	int i;
-	struct wcd9xxx *core = dev_get_drvdata(codec->dev->parent);
+	struct wcd9xxx *core = NULL;
+
+	if (codec == NULL) {
+		dev_err(codec->dev, "%s: codec not initialized\n", __func__);
+		return NULL;
+	}
+	core = dev_get_drvdata(codec->dev->parent);
+	if (core == NULL) {
+		dev_err(codec->dev, "%s: core not initialized\n", __func__);
+		return NULL;
+	}
 
 	for (i = 0; i < core->num_of_supplies; i++) {
 		if (core->supplies[i].supply &&