]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/commitdiff
usb: gadget: pch-udc: fix lock
authorFelipe Balbi <balbi@ti.com>
Mon, 28 Sep 2015 15:45:47 +0000 (10:45 -0500)
committerFelipe Balbi <balbi@ti.com>
Mon, 28 Sep 2015 16:24:29 +0000 (11:24 -0500)
gadget methods should be called without
spinlocks held.

Reported-by: Alexey Khoroshilov <khoroshilov@ispras.ru>
Signed-off-by: Felipe Balbi <balbi@ti.com>
drivers/usb/gadget/udc/pch_udc.c

index e5f4c5274298684576ac33794da6d929249af797..3181fc9c1c499ed77dfdc6b671fbd4a4a5a473f2 100644 (file)
@@ -2747,18 +2747,18 @@ static void pch_udc_dev_isr(struct pch_udc_dev *dev, u32 dev_intr)
        if (dev_intr & UDC_DEVINT_US) {
                if (dev->driver
                        && dev->driver->suspend) {
-                       spin_lock(&dev->lock);
-                       dev->driver->suspend(&dev->gadget);
                        spin_unlock(&dev->lock);
+                       dev->driver->suspend(&dev->gadget);
+                       spin_lock(&dev->lock);
                }
 
                vbus = pch_vbus_gpio_get_value(dev);
                if ((dev->vbus_session == 0)
                        && (vbus != 1)) {
                        if (dev->driver && dev->driver->disconnect) {
-                               spin_lock(&dev->lock);
-                               dev->driver->disconnect(&dev->gadget);
                                spin_unlock(&dev->lock);
+                               dev->driver->disconnect(&dev->gadget);
+                               spin_lock(&dev->lock);
                        }
                        pch_udc_reconnect(dev);
                } else if ((dev->vbus_session == 0)