Commit 943c4419 authored by Wojtek Kaniewski's avatar Wojtek Kaniewski Committed by Greg Kroah-Hartman

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: default avatarWojtek Kaniewski <wojtekka@toxygen.net>
Acked-by: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Cc: Andrew Victor <andrew@sanpeople.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent bc92c32a
......@@ -1601,6 +1601,10 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver)
if (retval) {
DBG("driver->bind() returned %d\n", retval);
udc->driver = NULL;
udc->gadget.dev.driver = NULL;
udc->gadget.dev.driver_data = NULL;
udc->enabled = 0;
udc->selfpowered = 0;
return retval;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment