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

Commit 42adf5ed authored by Jack Pham's avatar Jack Pham
Browse files

usb: dwc3: Handle suspicious GEVNTCOUNT



In rare cases it is observed that dwc3_check_event_buf() will
read a suspiciously high GEVNTCOUNT (0xFFFC) which is obviously
larger than the configured event buffer itself. This seems to
come up even after the GEVNTCOUNT register was written as 0 in
dwc3_event_buffers_setup(). Work around this issue by ignoring
the incorrect high count and treating it as no events.

Change-Id: Id0d7e3ec85ed043c58dff9c529fd3bec9cd2b8b0
Signed-off-by: default avatarJack Pham <jackp@codeaurora.org>
parent c8ba6a8b
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -3473,6 +3473,11 @@ static irqreturn_t dwc3_check_event_buf(struct dwc3 *dwc, u32 buf)
	if (!count)
		return IRQ_NONE;

	if (count > evt->length) {
		dev_warn(dwc->dev, "%s: ev_count is huge: %d", __func__, count);
		return IRQ_NONE;
	}

	evt->count = count;
	evt->flags |= DWC3_EVENT_PENDING;