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->devnum);
 	if (dev->actconfig) {
 		for (i = 0; i < dev->actconfig->bNumInterfaces; i++) {
 			struct usb_interface *interface = &dev->actconfig->interface[i];
@@ -799,12 +800,13 @@
 		}
 	}
 
+	dbg ("unregistering the device %d", dev->devnum);
 	/* Free the device number and remove the /proc/bus/usb entry */
 	if (dev->devnum > 0) {
 		clear_bit(dev->devnum, dev->bus->devmap.devicemap);
 		usbfs_remove_device(dev);
-		device_unregister(&dev->dev);
 	}
+	device_unregister(&dev->dev);
 
 	/* Decrement the reference count, it'll auto free everything when */
 	/* it hits 0 which could very well be now */
