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

Commit 3737f15c authored by Ajay Agarwal's avatar Ajay Agarwal Committed by Gerrit - the friendly Code Review server
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 026280fc
Loading
Loading
Loading
Loading
+8 −6
Original line number Diff line number Diff line
@@ -2482,12 +2482,14 @@ static void dwc3_msm_notify_event(struct dwc3 *dwc,
		break;
	case DWC3_CONTROLLER_NOTIFY_CLEAR_DB:
		dev_dbg(mdwc->dev, "DWC3_CONTROLLER_NOTIFY_CLEAR_DB\n");
		if (mdwc->gsi_reg) {
			dwc3_msm_write_reg_field(mdwc->base,
				GSI_GENERAL_CFG_REG(mdwc->gsi_reg),
				BLOCK_GSI_WR_GO_MASK, true);
			dwc3_msm_write_reg_field(mdwc->base,
				GSI_GENERAL_CFG_REG(mdwc->gsi_reg),
				GSI_EN_MASK, 0);
		}
		break;
	default:
		dev_dbg(mdwc->dev, "unknown dwc3 event\n");