usb: dwc2: Don't program DMA address for 0 length request
authorRazmik Karapetyan <razmik@synopsys.com>
Wed, 16 Nov 2016 23:33:55 +0000 (15:33 -0800)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Fri, 18 Nov 2016 11:54:52 +0000 (13:54 +0200)
Check the request length in dwc2_hsotg_start_req() function. If
length == 0, do not write DMA address to control register.

Signed-off-by: Razmik Karapetyan <razmik@synopsys.com>
Signed-off-by: John Youn <johnyoun@synopsys.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/dwc2/gadget.c

index ad0cd0e38f061d8674f2b457ebc6b8fa60d453cd..4dd5f1e2d2819eae9dbb7d24c383f5bd6b03b32f 100644 (file)
@@ -1018,7 +1018,7 @@ static void dwc2_hsotg_start_req(struct dwc2_hsotg *hsotg,
                /* write size / packets */
                dwc2_writel(epsize, hsotg->regs + epsize_reg);
 
-               if (using_dma(hsotg) && !continuing) {
+               if (using_dma(hsotg) && !continuing && (length != 0)) {
                        /*
                         * write DMA address to control register, buffer
                         * already synced by dwc2_hsotg_ep_queue().