Message ID | 4423b9f3-d70b-4576-80cf-79c9c77f6aba@US01WEHTC1.internal.synopsys.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | [v2] usb: dwc3: gadget: Handle 0 xfer length for OUT EP | expand |
Hello! On 01/21/2019 12:33 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) Please enclose the summary in (""), no just (). And please never wrap it. > Cc: stable@vger.kernel.org > > Signed-off-by: Tejas Joglekar <joglekar@synopsys.com> [...] MBR, Sergei
Hi, On 1/21/2019 9:47 PM, Sergei Shtylyov wrote: > Hello! > > On 01/21/2019 12:33 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) > Please enclose the summary in (""), no just (). And please never wrap it. Sure, I will send v3. >> Cc: stable@vger.kernel.org >> >> Signed-off-by: Tejas Joglekar <joglekar@synopsys.com> > [...] > > MBR, Sergei > Thanks & Regards, 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 v2: - Remove sg patch hunk - added fixes and stable tag drivers/usb/dwc3/gadget.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)