diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-05-06 15:41:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-20 18:15:29 -0400 |
commit | f409661877a25d11c2495bcd879807f17c286684 (patch) | |
tree | ce14b7c16191af662d087c9be4a3fcbe642a63af | |
parent | c95a6b057b108c2b7add35cba1354f9af921349e (diff) |
[PATCH] usbcore: Don't call device_release_driver recursively
This patch fixes usb_driver_release_interface() to make it avoid calling
device_release_driver() recursively, i.e., when invoked from within the
disconnect routine for the same device. The patch applies to your
"driver" tree.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r-- | drivers/usb/core/usb.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 66678763c24d..a3c42203213a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -322,9 +322,15 @@ void usb_driver_release_interface(struct usb_driver *driver, | |||
322 | if (!dev->driver || dev->driver != &driver->driver) | 322 | if (!dev->driver || dev->driver != &driver->driver) |
323 | return; | 323 | return; |
324 | 324 | ||
325 | /* don't disconnect from disconnect(), or before dev_add() */ | 325 | /* don't release from within disconnect() */ |
326 | if (!klist_node_attached(&dev->knode_driver) && !klist_node_attached(&dev->knode_bus)) | 326 | if (iface->condition != USB_INTERFACE_BOUND) |
327 | return; | ||
328 | |||
329 | /* release only after device_add() */ | ||
330 | if (klist_node_attached(&dev->knode_bus)) { | ||
331 | iface->condition = USB_INTERFACE_UNBINDING; | ||
327 | device_release_driver(dev); | 332 | device_release_driver(dev); |
333 | } | ||
328 | 334 | ||
329 | dev->driver = NULL; | 335 | dev->driver = NULL; |
330 | usb_set_intfdata(iface, NULL); | 336 | usb_set_intfdata(iface, NULL); |