<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">ChangeSet 1.793.1.19, 2002/10/18 11:35:15-07:00, greg@kroah.com

USB: fix problem with removing a USB root hub.


diff -Nru a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
--- a/drivers/usb/core/usb.c	Fri Oct 18 14:42:59 2002
+++ b/drivers/usb/core/usb.c	Fri Oct 18 14:42:59 2002
@@ -790,6 +790,7 @@
 			usb_disconnect(child);
 	}
 
+	dbg ("unregistering interfaces on device %d", dev-&gt;devnum);
 	if (dev-&gt;actconfig) {
 		for (i = 0; i &lt; dev-&gt;actconfig-&gt;bNumInterfaces; i++) {
 			struct usb_interface *interface = &amp;dev-&gt;actconfig-&gt;interface[i];
@@ -799,12 +800,13 @@
 		}
 	}
 
+	dbg ("unregistering the device %d", dev-&gt;devnum);
 	/* Free the device number and remove the /proc/bus/usb entry */
 	if (dev-&gt;devnum &gt; 0) {
 		clear_bit(dev-&gt;devnum, dev-&gt;bus-&gt;devmap.devicemap);
 		usbfs_remove_device(dev);
-		device_unregister(&amp;dev-&gt;dev);
 	}
+	device_unregister(&amp;dev-&gt;dev);
 
 	/* Decrement the reference count, it'll auto free everything when */
 	/* it hits 0 which could very well be now */
</pre></body></html>