From: John Keeping <john@metanate.com> To: Minas Harutyunyan <hminas@synopsys.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, John Keeping <john@metanate.com> Subject: [PATCH] usb: dwc2: gadget: fix ISOC frame overflow handling Date: Tue, 23 Oct 2018 14:43:55 +0100 [thread overview] Message-ID: <20181023134355.29829-1-john@metanate.com> (raw) 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
WARNING: multiple messages have this Message-ID (diff)
From: John Keeping <john@metanate.com> To: Minas Harutyunyan <hminas@synopsys.com> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, John Keeping <john@metanate.com> Subject: usb: dwc2: gadget: fix ISOC frame overflow handling Date: Tue, 23 Oct 2018 14:43:55 +0100 [thread overview] Message-ID: <20181023134355.29829-1-john@metanate.com> (raw) 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; } }
next reply other threads:[~2018-10-23 14:07 UTC|newest] Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top 2018-10-23 13:43 John Keeping [this message] 2018-10-23 13:43 ` usb: dwc2: gadget: fix ISOC frame overflow handling 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
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20181023134355.29829-1-john@metanate.com \ --to=john@metanate.com \ --cc=gregkh@linuxfoundation.org \ --cc=hminas@synopsys.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-usb@vger.kernel.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
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.