All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc2: gadget: fix ISOC frame overflow handling
@ 2018-10-23 13:43 ` John Keeping
  0 siblings, 0 replies; 26+ messages in thread
From: John Keeping @ 2018-10-23 13:43 UTC (permalink / raw)
  To: Minas Harutyunyan
  Cc: Greg Kroah-Hartman, linux-usb, linux-kernel, John Keeping

By clearing the overrun flag as soon as the target frame is next
incremented, we can end up incrementing the target frame more than
expected in dwc2_gadget_handle_ep_disabled() when the endpoint's
interval is greater than 1.  This happens if the target frame has just
wrapped at the point when the endpoint is disabled and the frame number
has not yet done so.

Instead, wait until the frame number also wraps and then clear the
overrun flag.

Signed-off-by: John Keeping <john@metanate.com>
---
 drivers/usb/dwc2/gadget.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
index 2d6d2c8244de..8da2c052dfa1 100644
--- a/drivers/usb/dwc2/gadget.c
+++ b/drivers/usb/dwc2/gadget.c
@@ -117,7 +117,7 @@ static inline void dwc2_gadget_incr_frame_num(struct dwc2_hsotg_ep *hs_ep)
 	if (hs_ep->target_frame > DSTS_SOFFN_LIMIT) {
 		hs_ep->frame_overrun = true;
 		hs_ep->target_frame &= DSTS_SOFFN_LIMIT;
-	} else {
+	} else if (hs_ep->parent->frame_number < hs_ep->target_frame) {
 		hs_ep->frame_overrun = false;
 	}
 }
-- 
2.19.1


^ permalink raw reply related	[flat|nested] 26+ messages in thread

end of thread, other threads:[~2018-12-24  7:18 UTC | newest]

Thread overview: 26+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-23 13:43 [PATCH] usb: dwc2: gadget: fix ISOC frame overflow handling John Keeping
2018-10-23 13:43 ` John Keeping
2018-11-05  8:28 ` [PATCH] " Minas Harutyunyan
2018-11-05  8:28   ` Minas Harutyunyan
2018-11-08 17:36   ` [PATCH] " John Keeping
2018-11-08 17:36     ` John Keeping
2018-11-09  8:43     ` [PATCH] " Minas Harutyunyan
2018-11-09  8:43       ` Minas Harutyunyan
2018-11-09 14:36       ` [PATCH] " Minas Harutyunyan
2018-11-09 14:36         ` Minas Harutyunyan
2018-11-09 18:42         ` [PATCH] " John Keeping
2018-11-09 18:42           ` John Keeping
2018-11-12  8:53           ` [PATCH] " Minas Harutyunyan
2018-11-12  8:53             ` Minas Harutyunyan
2018-11-12 22:46             ` [PATCH] " John Keeping
2018-11-12 22:46               ` John Keeping
2018-12-14  9:00               ` [PATCH] " Minas Harutyunyan
2018-12-14  9:00                 ` Minas Harutyunyan
2018-12-18 14:35                 ` [PATCH] " John Keeping
2018-12-18 14:35                   ` John Keeping
2018-12-19 14:09                   ` [PATCH] " Minas Harutyunyan
2018-12-19 14:09                     ` Minas Harutyunyan
2018-12-21 16:05                     ` [PATCH] " John Keeping
2018-12-21 16:05                       ` John Keeping
2018-12-24  7:18                       ` [PATCH] " Minas Harutyunyan
2018-12-24  7:18                         ` Minas Harutyunyan

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.