diff options
author | Tejas Joglekar <tejas.joglekar@synopsys.com> | 2019-01-22 13:26:51 +0530 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-02-12 19:46:12 +0100 |
commit | 09145ec8138ee67ba4565058b171c743ee2c1713 (patch) | |
tree | e407602637d9f2ac223a473acb8e2a5c8ed665ce /drivers/usb | |
parent | fb151544446b7f51d08b83dc30546298d7bdc666 (diff) | |
download | linux-stable-09145ec8138ee67ba4565058b171c743ee2c1713.tar.gz linux-stable-09145ec8138ee67ba4565058b171c743ee2c1713.tar.bz2 linux-stable-09145ec8138ee67ba4565058b171c743ee2c1713.zip |
usb: dwc3: gadget: Handle 0 xfer length for OUT EP
commit 1e19cdc8060227b0802bda6bc0bd22b23679ba32 upstream.
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>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/dwc3/gadget.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 5b34994b7b08..2f96d2d0addd 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1114,7 +1114,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; |