提交 86d30741 编写于 作者: A Alan Stern 提交者: Linus Torvalds

[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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: NLinus Torvalds <torvalds@osdl.org>
上级 4a0d73c4
......@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0)
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 @@ int usb_set_configuration(struct usb_device *dev, int configuration)
}
}
return ret;
return 0;
}
// synchronous request completion model
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册