aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/dummy_hcd.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/gadget/dummy_hcd.c')
-rw-r--r--drivers/usb/gadget/dummy_hcd.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
index f1f32d7be5f9..3c2bc075ef4f 100644
--- a/drivers/usb/gadget/dummy_hcd.c
+++ b/drivers/usb/gadget/dummy_hcd.c
@@ -779,7 +779,7 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver)
779 return -EINVAL; 779 return -EINVAL;
780 if (dum->driver) 780 if (dum->driver)
781 return -EBUSY; 781 return -EBUSY;
782 if (!driver->bind || !driver->unbind || !driver->setup 782 if (!driver->bind || !driver->setup
783 || driver->speed == USB_SPEED_UNKNOWN) 783 || driver->speed == USB_SPEED_UNKNOWN)
784 return -EINVAL; 784 return -EINVAL;
785 785
@@ -837,7 +837,8 @@ usb_gadget_register_driver (struct usb_gadget_driver *driver)
837err_bind_driver: 837err_bind_driver:
838 driver_unregister (&driver->driver); 838 driver_unregister (&driver->driver);
839err_register: 839err_register:
840 driver->unbind (&dum->gadget); 840 if (driver->unbind)
841 driver->unbind (&dum->gadget);
841 spin_lock_irq (&dum->lock); 842 spin_lock_irq (&dum->lock);
842 dum->pullup = 0; 843 dum->pullup = 0;
843 set_link_state (dum); 844 set_link_state (dum);
@@ -857,7 +858,7 @@ usb_gadget_unregister_driver (struct usb_gadget_driver *driver)
857 858
858 if (!dum) 859 if (!dum)
859 return -ENODEV; 860 return -ENODEV;
860 if (!driver || driver != dum->driver) 861 if (!driver || driver != dum->driver || !driver->unbind)
861 return -EINVAL; 862 return -EINVAL;
862 863
863 dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n", 864 dev_dbg (udc_dev(dum), "unregister gadget driver '%s'\n",