]> git.karo-electronics.de Git - linux-beck.git/commitdiff
usb: gadget: pch_udc: don't free devm allocated memory
authorFelipe Balbi <felipe.balbi@linux.intel.com>
Mon, 18 Apr 2016 09:57:15 +0000 (12:57 +0300)
committerFelipe Balbi <felipe.balbi@linux.intel.com>
Tue, 19 Apr 2016 08:11:56 +0000 (11:11 +0300)
Coccinelle caught this instance of us kfree()ing
devm-allocated memory. The solution is just to not
do anything in our gadget_release.

Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
drivers/usb/gadget/udc/pch_udc.c

index b2b70d4e2f5be478e7f02e673f1736995d8467dc..ebc51ec5790afaef0f261af9644f4e655c757f5e 100644 (file)
@@ -2834,17 +2834,6 @@ static void pch_udc_setup_ep0(struct pch_udc_dev *dev)
                                       UDC_DEVINT_SI | UDC_DEVINT_SC);
 }
 
-/**
- * gadget_release() - Free the gadget driver private data
- * @pdev       reference to struct pci_dev
- */
-static void gadget_release(struct device *pdev)
-{
-       struct pch_udc_dev *dev = dev_get_drvdata(pdev);
-
-       kfree(dev);
-}
-
 /**
  * pch_udc_pcd_reinit() - This API initializes the endpoint structures
  * @dev:       Reference to the driver structure
@@ -3151,8 +3140,7 @@ static int pch_udc_probe(struct pci_dev *pdev,
 
        /* Put the device in disconnected state till a driver is bound */
        pch_udc_set_disconnect(dev);
-       retval = usb_add_gadget_udc_release(&pdev->dev, &dev->gadget,
-                       gadget_release);
+       retval = usb_add_gadget_udc(&pdev->dev, &dev->gadget);
        if (retval)
                goto finished;
        return 0;