diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2005-07-29 15:17:16 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@g5.osdl.org> | 2005-07-29 16:12:53 -0400 |
commit | 86d30741e480f40676c2173e1153368a4846da48 (patch) | |
tree | a30c3e34a033f71b1fbf4b96b22555f85cb641a7 /drivers | |
parent | 4a0d73c463765ce34b22ac3924d0661caf2a7539 (diff) |
[PATCH] USB: Usbcore: Don't try to delete unregistered interfaces
This patch handles a rarely-encountered failure mode in usbcore. It's
legal for device_add to fail (although now it happens even more rarely
than before since failure to bind a driver is no longer fatal). So when
we destroy the interfaces in a configuration, we shouldn't try to delete
ones which weren't successfully registered. Also, failure to register an
interface shouldn't be fatal either -- I think; you may disagree about
this part of the patch.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/core/message.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a428ef479bd7..88d1b376f67c 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { | 985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { |
986 | struct usb_interface *interface; | 986 | struct usb_interface *interface; |
987 | 987 | ||
988 | /* remove this interface */ | 988 | /* remove this interface if it has been registered */ |
989 | interface = dev->actconfig->interface[i]; | 989 | interface = dev->actconfig->interface[i]; |
990 | if (!klist_node_attached(&interface->dev.knode_bus)) | ||
991 | continue; | ||
990 | dev_dbg (&dev->dev, "unregistering interface %s\n", | 992 | dev_dbg (&dev->dev, "unregistering interface %s\n", |
991 | interface->dev.bus_id); | 993 | interface->dev.bus_id); |
992 | usb_remove_sysfs_intf_files(interface); | 994 | usb_remove_sysfs_intf_files(interface); |
@@ -1439,7 +1441,7 @@ free_interfaces: | |||
1439 | } | 1441 | } |
1440 | } | 1442 | } |
1441 | 1443 | ||
1442 | return ret; | 1444 | return 0; |
1443 | } | 1445 | } |
1444 | 1446 | ||
1445 | // synchronous request completion model | 1447 | // synchronous request completion model |