diff options
author | Jeff Garzik <jeff@garzik.org> | 2006-09-27 18:13:53 -0400 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2006-09-27 18:13:53 -0400 |
commit | aebb1153ac54ddbbd3d3f0481a193f4bf0ead53b (patch) | |
tree | 57425aa83c8bed5b41af7e3408024fe1f2fdded9 /drivers/usb/core/endpoint.c | |
parent | 022e7a12b6aa11a11de4d708fe8606c9a6734b37 (diff) | |
parent | a77c64c1a641950626181b4857abb701d8f38ccc (diff) |
Merge branch 'master' into upstream
Diffstat (limited to 'drivers/usb/core/endpoint.c')
-rw-r--r-- | drivers/usb/core/endpoint.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 247b5a4913a..3ebb90149e9 100644 --- a/drivers/usb/core/endpoint.c +++ b/drivers/usb/core/endpoint.c @@ -207,9 +207,9 @@ static void ep_device_release(struct device *dev) kfree(ep_dev); } -void usb_create_ep_files(struct device *parent, - struct usb_host_endpoint *endpoint, - struct usb_device *udev) +int usb_create_ep_files(struct device *parent, + struct usb_host_endpoint *endpoint, + struct usb_device *udev) { char name[8]; struct ep_device *ep_dev; @@ -242,19 +242,33 @@ void usb_create_ep_files(struct device *parent, retval = device_register(&ep_dev->dev); if (retval) goto error; - sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); + retval = sysfs_create_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); + if (retval) + goto error_group; endpoint->ep_dev = ep_dev; /* create the symlink to the old-style "ep_XX" directory */ sprintf(name, "ep_%02x", endpoint->desc.bEndpointAddress); - sysfs_create_link(&parent->kobj, &endpoint->ep_dev->dev.kobj, name); - + retval = sysfs_create_link(&parent->kobj, + &endpoint->ep_dev->dev.kobj, name); + if (retval) + goto error_link; exit: - return; + return retval; + +error_link: + sysfs_remove_group(&ep_dev->dev.kobj, &ep_dev_attr_grp); + +error_group: + device_unregister(&ep_dev->dev); + endpoint->ep_dev = NULL; + destroy_endpoint_class(); + return retval; error: kfree(ep_dev); - return; + destroy_endpoint_class(); + return retval; } void usb_remove_ep_files(struct usb_host_endpoint *endpoint) |