From 53572b845a42e562b39bbcaa9fb1faffcfeaccad Mon Sep 17 00:00:00 2001 From: Karthikeyan Mani Date: Wed, 15 Mar 2017 12:44:56 -0700 Subject: ASoC: codecs: Fix mbhc data NULL pointer dereferencing Initialize completion structure in wcd_mbhc_initialize and wcd_mbhc_init to handle irq handlers getting called before the completion structure is initialized and ready for use. CRs-fixed: 2020227 Change-Id: Ibc7a5974adfe803c5b9892986165e2e1e3151fc7 Signed-off-by: Karthikeyan Mani --- sound/soc/codecs/wcd-mbhc-v2.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/sound/soc/codecs/wcd-mbhc-v2.c b/sound/soc/codecs/wcd-mbhc-v2.c index 7f9ad8ebcd3d..44141ae5668e 100644 --- a/sound/soc/codecs/wcd-mbhc-v2.c +++ b/sound/soc/codecs/wcd-mbhc-v2.c @@ -2217,7 +2217,7 @@ static int wcd_mbhc_initialise(struct wcd_mbhc *mbhc) INIT_WORK(&mbhc->correct_plug_swch, wcd_correct_swch_plug); - init_completion(&mbhc->btn_press_compl); + reinit_completion(&mbhc->btn_press_compl); WCD_MBHC_RSC_UNLOCK(mbhc); pr_debug("%s: leave\n", __func__); @@ -2854,6 +2854,7 @@ int wcd_mbhc_init(struct wcd_mbhc *mbhc, struct snd_soc_codec *codec, } mutex_init(&mbhc->hphl_pa_lock); mutex_init(&mbhc->hphr_pa_lock); + init_completion(&mbhc->btn_press_compl); /* Register event notifier */ mbhc->nblock.notifier_call = wcd_event_notify; -- cgit v1.2.3