ChangeSet 1.1760.26.2, 2004/06/23 15:39:20-07:00, stern@rowland.harvard.edu

[PATCH] USB: Fail pending URBs in dummy_hcd upon disconnect

This patch fixes another bug in the dummy_hcd driver.  When a gadget
driver unregisters (simulating a device disconnect), dummy_hcd stops the
timer that it uses for processing outstanding URBs.  Unfortunately this
means that those URBs will never be given back.  The patch lets the timer
continue running; when it expires all the remaining URBs will fail so the
timer won't be reinitialized.



Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>


 drivers/usb/gadget/dummy_hcd.c |    5 +----
 1 files changed, 1 insertion(+), 4 deletions(-)


diff -Nru a/drivers/usb/gadget/dummy_hcd.c b/drivers/usb/gadget/dummy_hcd.c
--- a/drivers/usb/gadget/dummy_hcd.c	2004-06-29 16:26:50 -07:00
+++ b/drivers/usb/gadget/dummy_hcd.c	2004-06-29 16:26:50 -07:00
@@ -739,11 +739,9 @@
 	struct dummy_ep	*ep;
 
 	/* prevent any more requests */
-	dum->hdev = 0;
 	dum->address = 0;
 
-	/* this might not succeed ... */
-	del_timer (&dum->timer);
+	/* The timer is left running so that outstanding URBs can fail */
 
 	/* nuke any pending requests first, so driver i/o is quiesced */
 	list_for_each_entry (ep, &dum->gadget.ep_list, ep.ep_list)
@@ -784,7 +782,6 @@
 
 	driver_unregister (&driver->driver);
 
-	del_timer_sync (&dum->timer);
 	return 0;
 }
 EXPORT_SYMBOL (usb_gadget_unregister_driver);