summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Stern <stern@rowland.harvard.edu>2007-10-19 15:51:58 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2007-10-25 21:18:44 +0200
commit439a903a9663c0caa8094f3907ca60069d6c36e7 (patch)
treeed6da5090918e824a2376f518a605e78ab0e5758
parentUSB: fix ssb_ohci_probe() build bug (diff)
downloadlinux-439a903a9663c0caa8094f3907ca60069d6c36e7.tar.xz
linux-439a903a9663c0caa8094f3907ca60069d6c36e7.zip
USB: fix interface sysfs file-creation bug
This patch (as1005) fixes a rather subtle problem. When usb_set_configuration() registers the interfaces and their files in sysfs, it doesn't expect those files to exist already. But when an interface is registered, its driver may call usb_set_interface() and thereby cause the sysfs files to be created. The result is an error when usb_set_configuration() goes on to create those same files again. The (not-so-great) solution is to have usb_set_configuration() remove any existing files before creating them. Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/core/message.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c
index 8bdaa157ffe7..eb4ac47612a5 100644
--- a/drivers/usb/core/message.c
+++ b/drivers/usb/core/message.c
@@ -1641,7 +1641,13 @@ free_interfaces:
intf->dev.bus_id, ret);
continue;
}
- usb_create_sysfs_intf_files (intf);
+
+ /* The driver's probe method can call usb_set_interface(),
+ * which would mean the interface's sysfs files are already
+ * created. Just in case, we'll remove them first.
+ */
+ usb_remove_sysfs_intf_files(intf);
+ usb_create_sysfs_intf_files(intf);
}
usb_autosuspend_device(dev);