Skip to content

Commit 1e19cdc

Browse files
Tejas JoglekarFelipe Balbi
authored andcommitted
usb: dwc3: gadget: Handle 0 xfer length for OUT EP
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: c6267a5 ("usb: dwc3: gadget: align transfers to wMaxPacketSize") Cc: stable@vger.kernel.org Signed-off-by: Tejas Joglekar <joglekar@synopsys.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
1 parent f17b5f0 commit 1e19cdc

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

drivers/usb/dwc3/gadget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1119,7 +1119,7 @@ static void dwc3_prepare_one_trb_linear(struct dwc3_ep *dep,
11191119
unsigned int maxp = usb_endpoint_maxp(dep->endpoint.desc);
11201120
unsigned int rem = length % maxp;
11211121

1122-
if (rem && usb_endpoint_dir_out(dep->endpoint.desc)) {
1122+
if ((!length || rem) && usb_endpoint_dir_out(dep->endpoint.desc)) {
11231123
struct dwc3 *dwc = dep->dwc;
11241124
struct dwc3_trb *trb;
11251125

0 commit comments

Comments
 (0)