lkml.org 
[lkml]   [2005]   [Jul]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[patch 22/29] USB: Usbcore: Don't try to delete unregistered interfaces
From: Alan Stern <stern@rowland.harvard.edu>

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>

---
drivers/usb/core/message.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

--- gregkh-2.6.orig/drivers/usb/core/message.c 2005-07-29 11:29:48.000000000 -0700
+++ gregkh-2.6/drivers/usb/core/message.c 2005-07-29 11:36:29.000000000 -0700
@@ -985,8 +985,10 @@
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 @@
}
}

- return ret;
+ return 0;
}

// synchronous request completion model
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-07-29 21:24    [W:2.127 / U:0.000 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site