ASoC: wcd-mbhc: Fix null pointer dereference for mbhc

IRQ data pointer is corrupted due to slimbus NGD errors.
This may happen as IRQ will be received from slimbus.
Check for mbhc null pointer before dereferencing to avoid crash.

Change-Id: I142ee535c6d643b53063b57c0f45414aff8b6304
Signed-off-by: Vatsal Bucha <vbucha@codeaurora.org>
This commit is contained in:
Vatsal Bucha
2019-10-22 11:07:07 +05:30
parent 360a45bad1
commit fc40b33b24

View File

@@ -1055,6 +1055,10 @@ static irqreturn_t wcd_mbhc_mech_plug_detect_irq(int irq, void *data)
struct wcd_mbhc *mbhc = data;
pr_debug("%s: enter\n", __func__);
if (mbhc == NULL) {
pr_err("%s: NULL irq data\n", __func__);
return IRQ_NONE;
}
if (unlikely((mbhc->mbhc_cb->lock_sleep(mbhc, true)) == false)) {
pr_warn("%s: failed to hold suspend\n", __func__);
r = IRQ_NONE;