diff options
author | Wojtek Kaniewski <wojtekka@toxygen.net> | 2006-12-08 06:23:00 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-12-20 13:14:27 -0500 |
commit | 943c441948581bd01ab196a4d32da88bfa0f13ce (patch) | |
tree | e985bcf811c13a576a4169dde2b2dd8258d1c009 /drivers/usb/gadget/at91_udc.c | |
parent | bc92c32aa21cf2e8808f8cff0be0a2a653652e92 (diff) |
USB: at91_udc: Cleanup variables after failure in usb_gadget_register_driver()
This patch zeroes some variables when usb_gadget_register_driver()
fails. gadgetfs does a dummy registration to get the name of the USB
driver and then waits for user-land driver. If someone plugs the cable
in the meantime, bad things happen, because at91_udc has been left in
inconsistent state.
Signed-off-by: Wojtek Kaniewski <wojtekka@toxygen.net>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Cc: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/at91_udc.c')
-rw-r--r-- | drivers/usb/gadget/at91_udc.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/gadget/at91_udc.c b/drivers/usb/gadget/at91_udc.c index 38a2e113e705..1926d39e4801 100644 --- a/drivers/usb/gadget/at91_udc.c +++ b/drivers/usb/gadget/at91_udc.c | |||
@@ -1601,6 +1601,10 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver) | |||
1601 | if (retval) { | 1601 | if (retval) { |
1602 | DBG("driver->bind() returned %d\n", retval); | 1602 | DBG("driver->bind() returned %d\n", retval); |
1603 | udc->driver = NULL; | 1603 | udc->driver = NULL; |
1604 | udc->gadget.dev.driver = NULL; | ||
1605 | udc->gadget.dev.driver_data = NULL; | ||
1606 | udc->enabled = 0; | ||
1607 | udc->selfpowered = 0; | ||
1604 | return retval; | 1608 | return retval; |
1605 | } | 1609 | } |
1606 | 1610 | ||