During "modprobe -r pch_udc" we receive a warning about freeing a "bad dma" 
request.

* Properly free the requests from the PCI pool they where allocated in.

Signed-off-by: Mark Ferrell <mferr...@uplogix.com>

---
 drivers/usb/gadget/pch_udc.c |   13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/gadget/pch_udc.c b/drivers/usb/gadget/pch_udc.c
index 24174e1..2fe5f46 100644
--- a/drivers/usb/gadget/pch_udc.c
+++ b/drivers/usb/gadget/pch_udc.c
@@ -3043,8 +3043,14 @@ static void pch_udc_remove(struct pci_dev *pdev)
                dev_err(&pdev->dev,
                        "%s: gadget driver still bound!!!\n", __func__);
        /* dma pool cleanup */
-       if (dev->data_requests)
+       if (dev->data_requests) {
+               if (dev->ep[UDC_EP0OUT_IDX].td_data) {
+                       pci_pool_free(dev->data_requests,
+                               dev->ep[UDC_EP0OUT_IDX].td_data,
+                               dev->ep[UDC_EP0OUT_IDX].td_data_phys);
+               }
                pci_pool_destroy(dev->data_requests);
+       }
 
        if (dev->stp_requests) {
                /* cleanup DMA desc's for ep0in */
@@ -3053,11 +3059,6 @@ static void pch_udc_remove(struct pci_dev *pdev)
                                dev->ep[UDC_EP0OUT_IDX].td_stp,
                                dev->ep[UDC_EP0OUT_IDX].td_stp_phys);
                }
-               if (dev->ep[UDC_EP0OUT_IDX].td_data) {
-                       pci_pool_free(dev->stp_requests,
-                               dev->ep[UDC_EP0OUT_IDX].td_data,
-                               dev->ep[UDC_EP0OUT_IDX].td_data_phys);
-               }
                pci_pool_destroy(dev->stp_requests);
        }
 
-- 
tg: (b36f4be..) upstream/usb/gadget/pch_udc/dma_pool (depends on: master)
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to