Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 53dc2145 authored by Ajay Agarwal's avatar Ajay Agarwal
Browse files

usb: dwc3-msm: Avoid access of gsi_reg for non-GSI targets



Some targets do not have GSI feature. For such targets, gsi_reg
array does not get allocated. DWC3_CONTROLLER_NOTIFY_CLEAR_DB
event from gadget driver will access this unallocated memory.
Fix this by putting a check for gsi_reg.

Change-Id: I9903c0c6533abf3d6e689a40ea84ecbc066e10d8
Signed-off-by: default avatarAjay Agarwal <ajaya@codeaurora.org>
parent 544f874d
Loading
Loading
Loading
Loading
+4 −3
Original line number Original line Diff line number Diff line
@@ -2179,6 +2179,7 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc, unsigned int event,
		break;
		break;
	case DWC3_CONTROLLER_NOTIFY_CLEAR_DB:
	case DWC3_CONTROLLER_NOTIFY_CLEAR_DB:
		dev_dbg(mdwc->dev, "DWC3_CONTROLLER_NOTIFY_CLEAR_DB\n");
		dev_dbg(mdwc->dev, "DWC3_CONTROLLER_NOTIFY_CLEAR_DB\n");
		if (mdwc->gsi_reg)
			dwc3_msm_write_reg_field(mdwc->base,
			dwc3_msm_write_reg_field(mdwc->base,
			    GSI_GENERAL_CFG_REG(mdwc->gsi_reg[GENERAL_CFG_REG]),
			    GSI_GENERAL_CFG_REG(mdwc->gsi_reg[GENERAL_CFG_REG]),
			    BLOCK_GSI_WR_GO_MASK, true);
			    BLOCK_GSI_WR_GO_MASK, true);