From 8d8602219bfb914bc8060a845c946a09d20c1723 Mon Sep 17 00:00:00 2001 From: Vatsal Bucha Date: Tue, 3 Jul 2018 14:05:53 +0530 Subject: [PATCH] wcd934x: Fix NULL pointer dereference for wcd9xxx pointer During bind/unbind of ngd_msm_ctrl power_gate_digital_core is called. Simultaneously tavil_remove is also called making tavil pointer as NULL. Check for tavil as not NULL at the start of function to avoid NULL pointer dereference. CRs-Fixed: 2267796 Change-Id: I6fc476cc8b706b556836f30838983de0f34d4fc1 Signed-off-by: Vatsal Bucha --- asoc/codecs/wcd934x/wcd934x.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/asoc/codecs/wcd934x/wcd934x.c b/asoc/codecs/wcd934x/wcd934x.c index 44f741e795..2dde1de269 100644 --- a/asoc/codecs/wcd934x/wcd934x.c +++ b/asoc/codecs/wcd934x/wcd934x.c @@ -8939,6 +8939,8 @@ static struct snd_soc_dai_driver tavil_i2s_dai[] = { static void tavil_codec_power_gate_digital_core(struct tavil_priv *tavil) { + if (!tavil) + return; mutex_lock(&tavil->power_lock); dev_dbg(tavil->dev, "%s: Entering power gating function, %d\n", __func__, tavil->power_active_ref);