Greg:

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.

Alan Stern

P.S.:  What do you think about giving the klist_node_attached calls a more
descriptive name, like device_is_registered?



Signed-off-by: Alan Stern <[EMAIL PROTECTED]>

Index: usb-2.6/drivers/usb/core/message.c
===================================================================
--- usb-2.6.orig/drivers/usb/core/message.c
+++ usb-2.6/drivers/usb/core/message.c
@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_devic
                for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) {
                        struct usb_interface    *interface;
 
-                       /* remove this interface */
+                       /* remove this interface if it has been registered */
                        interface = dev->actconfig->interface[i];
+                       if (!klist_node_attached(&interface->dev.knode_bus))
+                               continue;
                        dev_dbg (&dev->dev, "unregistering interface %s\n",
                                interface->dev.bus_id);
                        usb_remove_sysfs_intf_files(interface);
@@ -1439,7 +1441,7 @@ free_interfaces:
                }
        }
 
-       return ret;
+       return 0;
 }
 
 // synchronous request completion model



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to