OSDN Git Service

usb: gadget: udc: renesas_usb3: fix free size in renesas_usb3_dma_free_prd()
authorYoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Tue, 18 Jul 2017 12:26:40 +0000 (21:26 +0900)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 18 Jul 2017 13:19:55 +0000 (16:19 +0300)
The commit 2d4aa21a73ba ("usb: gadget: udc: renesas_usb3: add support
for dedicated DMAC") has a bug in the renesas_usb3_dma_free_prd().
The size of dma_free_coherent() should be the same with dma_alloc_coherent()
Otherwise, this code causes a WARNING by mm/page_alloc.c when
renesas_usb3_dma_free_prd() is called. So, this patch fixes it.

Fixes: 2d4aa21a73ba ("usb: gadget: udc: renesas_usb3: add support for dedicated DMAC")
Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/renesas_usb3.c

index d827832..923ad5a 100644 (file)
@@ -1369,7 +1369,7 @@ static int renesas_usb3_dma_free_prd(struct renesas_usb3 *usb3,
 
        usb3_for_each_dma(usb3, dma, i) {
                if (dma->prd) {
-                       dma_free_coherent(dev, USB3_DMA_MAX_XFER_SIZE,
+                       dma_free_coherent(dev, USB3_DMA_PRD_SIZE,
                                          dma->prd, dma->prd_dma);
                        dma->prd = NULL;
                }