usb: dwc3: gadget: Handle 0 xfer length for OUT EP
commit003e5eab7547d87b0fed0eb4ce17ca5a43ee3ad0
authorTejas Joglekar <tejas.joglekar@synopsys.com>
Tue, 22 Jan 2019 07:56:51 +0000 (22 13:26 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 12 Feb 2019 19:02:36 +0000 (12 20:02 +0100)
treea0dd4a40ca3c10930fe87ea81b51f3ab88a3b5cd
parentd021bb6cd02ac79ad9ce084030872ddba0e7b63b
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>
drivers/usb/dwc3/gadget.c