aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/lh7a40x_udc.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/lh7a40x_udc.c')
-rw-r--r--drivers/usb/gadget/lh7a40x_udc.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
index 4a991564a03e..a0a73c08a344 100644
--- a/drivers/usb/gadget/lh7a40x_udc.c
+++ b/drivers/usb/gadget/lh7a40x_udc.c
@@ -422,9 +422,10 @@ int usb_gadget_register_driver(struct usb_gadget_driver *driver)
422 DEBUG("%s: %s\n", __FUNCTION__, driver->driver.name); 422 DEBUG("%s: %s\n", __FUNCTION__, driver->driver.name);
423 423
424 if (!driver 424 if (!driver
425 || driver->speed != USB_SPEED_FULL 425 || driver->speed != USB_SPEED_FULL
426 || !driver->bind 426 || !driver->bind
427 || !driver->unbind || !driver->disconnect || !driver->setup) 427 || !driver->disconnect
428 || !driver->setup)
428 return -EINVAL; 429 return -EINVAL;
429 if (!dev) 430 if (!dev)
430 return -ENODEV; 431 return -ENODEV;
@@ -471,7 +472,7 @@ int usb_gadget_unregister_driver(struct usb_gadget_driver *driver)
471 472
472 if (!dev) 473 if (!dev)
473 return -ENODEV; 474 return -ENODEV;
474 if (!driver || driver != dev->driver) 475 if (!driver || driver != dev->driver || !driver->unbind)
475 return -EINVAL; 476 return -EINVAL;
476 477
477 spin_lock_irqsave(&dev->lock, flags); 478 spin_lock_irqsave(&dev->lock, flags);
@@ -2125,9 +2126,11 @@ static int lh7a40x_udc_remove(struct platform_device *pdev)
2125 2126
2126 DEBUG("%s: %p\n", __FUNCTION__, pdev); 2127 DEBUG("%s: %p\n", __FUNCTION__, pdev);
2127 2128
2129 if (dev->driver)
2130 return -EBUSY;
2131
2128 udc_disable(dev); 2132 udc_disable(dev);
2129 remove_proc_files(); 2133 remove_proc_files();
2130 usb_gadget_unregister_driver(dev->driver);
2131 2134
2132 free_irq(IRQ_USBINTR, dev); 2135 free_irq(IRQ_USBINTR, dev);
2133 2136