Message ID | 7bbca67a-1508-4c35-b231-a3bcc8c2f714@US01WEHTC1.internal.synopsys.com (mailing list archive) |
---|---|
State | Mainlined |
Commit | 1e19cdc8060227b0802bda6bc0bd22b23679ba32 |
Headers | show |
Series | [v3] usb: dwc3: gadget: Handle 0 xfer length for OUT EP | expand |
Hi Felipe, Gentle reminder... any comments on my patch ? On 1/22/2019 1:27 PM, Tejas Joglekar wrote: > For OUT endpoints, zero-length transfers require MaxPacketSize buffer as > per the DWC_usb3 programming guide 3.30a section 4.2.3.3. > > This patch fixes this by explicitly checking zero length > transfer to correctly pad up to MaxPacketSize. > > Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") > Cc: stable@vger.kernel.org > > Signed-off-by: Tejas Joglekar <joglekar@synopsys.com> > --- > Changes in v3: > - Enclose summary for fixes with " " and no wrap > > Changes in v2: > - Remove sg patch hunk > - Added fixes and stable tag > > drivers/usb/dwc3/gadget.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c > index bed2ff4..6c9b76b 100644 > --- a/drivers/usb/dwc3/gadget.c > +++ b/drivers/usb/dwc3/gadget.c > @@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, > unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); > unsigned int rem = length % maxp; > > - if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) { > + if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) { > struct dwc3 *dwc = dep->dwc; > struct dwc3_trb *trb; > Thanks, Tejas Joglekar
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index bed2ff4..6c9b76b 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep, unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc); unsigned int rem = length % maxp; - if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) { + if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) { struct dwc3 *dwc = dep->dwc; struct dwc3_trb *trb;
For OUT endpoints, zero-length transfers require MaxPacketSize buffer as per the DWC_usb3 programming guide 3.30a section 4.2.3.3. This patch fixes this by explicitly checking zero length transfer to correctly pad up to MaxPacketSize. Fixes: c6267a51639b ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: stable@vger.kernel.org Signed-off-by: Tejas Joglekar <joglekar@synopsys.com> --- Changes in v3: - Enclose summary for fixes with " " and no wrap Changes in v2: - Remove sg patch hunk - Added fixes and stable tag drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)