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 <[EMAIL PROTECTED]>
Cc: Andrew Victor <[EMAIL PROTECTED]>
--- linux-2.6.19.orig/drivers/usb/gadget/at91_udc.c 2006-12-08
09:36:02.000000000 +0100
+++ linux-2.6.19/drivers/usb/gadget/at91_udc.c 2006-12-08 11:35:17.000000000
+0100
@@ -1595,6 +1601,10 @@ int usb_gadget_register_driver (struct u
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;
}
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel