dwc3-msm-core: Add NULL check against USB GSI event buffer

mdwc->gsi_ev_buff is seen NULL when dwc3_msm_notify_event() is getting
called from dwc3 driver's probe context as mdwc->gsi_ev_buff is being
allocated at end of dwc3_msm_core_init(). dwc3_otg_start_peripheral()
setups GSI event buffers with USB controller. Fix NULL pointer issue
by adding explicit check against NULL with mdwc->gsi_ev_buff.

Change-Id: Ia15b677b5fa55e4281a78fb877283fe37c9ad95f
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
This commit is contained in:
Mayank Rana 2022-06-23 20:42:14 -07:00 committed by Gerrit - the friendly Code Review server
parent 3912c8275c
commit 63c0cd6d2d

View File

@ -3321,6 +3321,9 @@ void dwc3_msm_notify_event(struct dwc3 *dwc,
break;
case DWC3_GSI_EVT_BUF_SETUP:
dev_dbg(mdwc->dev, "DWC3_GSI_EVT_BUF_SETUP\n");
if (!mdwc->gsi_ev_buff)
break;
for (i = 0; i < mdwc->num_gsi_event_buffers; i++) {
evt = mdwc->gsi_ev_buff[i];
if (!evt)