asoc: wcd-mbhc: check mbhc pointer to null before access
Check MBHC structure pointer to null before accessing. Change-Id: I21230b524a702dc5880904160d80f9f19564fc3a Signed-off-by: Phani Kumar Uppalapati <quic_phaniu@quicinc.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
// SPDX-License-Identifier: GPL-2.0-only
|
// SPDX-License-Identifier: GPL-2.0-only
|
||||||
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
/* Copyright (c) 2015-2021, The Linux Foundation. All rights reserved.
|
||||||
|
* Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
|
||||||
*/
|
*/
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/init.h>
|
#include <linux/init.h>
|
||||||
@@ -1142,6 +1143,10 @@ static irqreturn_t wcd_mbhc_mech_plug_detect_irq(int irq, void *data)
|
|||||||
|
|
||||||
pr_debug("%s: enter\n", __func__);
|
pr_debug("%s: enter\n", __func__);
|
||||||
|
|
||||||
|
if (mbhc == NULL) {
|
||||||
|
pr_err("%s: NULL irq data\n", __func__);
|
||||||
|
return IRQ_NONE;
|
||||||
|
}
|
||||||
/* WCD USB AATC did not required mech plug detection, will receive
|
/* WCD USB AATC did not required mech plug detection, will receive
|
||||||
* insertion/removal events from UCSI layer
|
* insertion/removal events from UCSI layer
|
||||||
*/
|
*/
|
||||||
@@ -1152,10 +1157,6 @@ static irqreturn_t wcd_mbhc_mech_plug_detect_irq(int irq, void *data)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (mbhc == NULL) {
|
|
||||||
pr_err("%s: NULL irq data\n", __func__);
|
|
||||||
return IRQ_NONE;
|
|
||||||
}
|
|
||||||
if (unlikely((mbhc->mbhc_cb->lock_sleep(mbhc, true)) == false)) {
|
if (unlikely((mbhc->mbhc_cb->lock_sleep(mbhc, true)) == false)) {
|
||||||
pr_warn("%s: failed to hold suspend\n", __func__);
|
pr_warn("%s: failed to hold suspend\n", __func__);
|
||||||
r = IRQ_NONE;
|
r = IRQ_NONE;
|
||||||
|
Reference in New Issue
Block a user