summaryrefslogtreecommitdiff
path: root/drivers/usb/dwc3
diff options
context:
space:
mode:
authorFelipe Balbi <felipe.balbi@linux.intel.com>2016-11-15 14:05:23 +0300
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-11-18 14:54:43 +0300
commitcaefe6c7be4778d0bddb38596ced1b60bd522b14 (patch)
treeec7d5aabf4df1bb4db1cde1cd2997eac06a0eae1 /drivers/usb/dwc3
parentd9fa4c63f7662c2e0aa8096250072f244f7737f2 (diff)
downloadlinux-caefe6c7be4778d0bddb38596ced1b60bd522b14.tar.xz
usb: dwc3: gadget: use evt->length as we should
Instead of always accessing the macro directly, let's rely on evt->length which is the actual length of current event buffer. While unlikely, we could change event buffer's size at any time. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/dwc3')
-rw-r--r--drivers/usb/dwc3/gadget.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 230ffa395dc3..304653fd9223 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -2834,7 +2834,7 @@ static irqreturn_t dwc3_process_event_buf(struct dwc3_event_buffer *evt)
* boundary so I worry about that once we try to handle
* that.
*/
- evt->lpos = (evt->lpos + 4) % DWC3_EVENT_BUFFERS_SIZE;
+ evt->lpos = (evt->lpos + 4) % evt->length;
left -= 4;
dwc3_writel(dwc->regs, DWC3_GEVNTCOUNT(0), 4);