diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-28 22:43:25 +0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 22:58:57 +0400 |
commit | 1b21d5e166e104f8914441ef52e2cd50ce65b479 (patch) | |
tree | e3139ee35d16be051d3dd01688bc29ec2afc7315 /drivers/usb | |
parent | 592fbbe4bc339399d363dd55f0391e0623400706 (diff) | |
download | linux-1b21d5e166e104f8914441ef52e2cd50ce65b479.tar.xz |
USB: fix __must_check warnings in drivers/usb/core/
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/core/devio.c | 2 | ||||
-rw-r--r-- | drivers/usb/core/driver.c | 10 | ||||
-rw-r--r-- | drivers/usb/core/endpoint.c | 30 | ||||
-rw-r--r-- | drivers/usb/core/sysfs.c | 55 | ||||
-rw-r--r-- | drivers/usb/core/usb.c | 6 | ||||
-rw-r--r-- | drivers/usb/core/usb.h | 6 |
6 files changed, 80 insertions, 29 deletions
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index fd345ad810f8..71bbd25a4ed0 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c @@ -1359,7 +1359,7 @@ static int proc_ioctl(struct dev_state *ps, struct usbdevfs_ioctl *ctl) /* let kernel drivers try to (re)bind to the interface */ case USBDEVFS_CONNECT: usb_unlock_device(ps->dev); - bus_rescan_devices(intf->dev.bus); + retval = bus_rescan_devices(intf->dev.bus); usb_lock_device(ps->dev); break; diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 0d063c8ca4b4..b10463244413 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c @@ -49,6 +49,7 @@ static ssize_t store_new_id(struct device_driver *driver, u32 idVendor = 0; u32 idProduct = 0; int fields = 0; + int retval = 0; fields = sscanf(buf, "%x %x", &idVendor, &idProduct); if (fields < 2) @@ -68,10 +69,12 @@ static ssize_t store_new_id(struct device_driver *driver, spin_unlock(&usb_drv->dynids.lock); if (get_driver(driver)) { - driver_attach(driver); + retval = driver_attach(driver); put_driver(driver); } + if (retval) + return retval; return count; } static DRIVER_ATTR(new_id, S_IWUSR, NULL, store_new_id); @@ -291,6 +294,7 @@ int usb_driver_claim_interface(struct usb_driver *driver, { struct device *dev = &iface->dev; struct usb_device *udev = interface_to_usbdev(iface); + int retval = 0; if (dev->driver) return -EBUSY; @@ -308,9 +312,9 @@ int usb_driver_claim_interface(struct usb_driver *driver, * the future device_add() bind it, bypassing probe() */ if (device_is_registered(dev)) - device_bind_driver(dev); + retval = device_bind_driver(dev); - return 0; + return retval; } EXPORT_SYMBOL(usb_driver_claim_interface); diff --git a/drivers/usb/core/endpoint.c b/drivers/usb/core/endpoint.c index 247b5a4913a8..3ebb90149e93 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) diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index cd2286246f6a..55d8f575206d 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c @@ -210,19 +210,40 @@ static struct attribute_group dev_attr_grp = { .attrs = dev_attrs, }; -void usb_create_sysfs_dev_files (struct usb_device *udev) +int usb_create_sysfs_dev_files(struct usb_device *udev) { struct device *dev = &udev->dev; + int retval; - sysfs_create_group(&dev->kobj, &dev_attr_grp); + retval = sysfs_create_group(&dev->kobj, &dev_attr_grp); + if (retval) + return retval; - if (udev->manufacturer) - device_create_file (dev, &dev_attr_manufacturer); - if (udev->product) - device_create_file (dev, &dev_attr_product); - if (udev->serial) - device_create_file (dev, &dev_attr_serial); - usb_create_ep_files(dev, &udev->ep0, udev); + if (udev->manufacturer) { + retval = device_create_file (dev, &dev_attr_manufacturer); + if (retval) + goto error; + } + if (udev->product) { + retval = device_create_file (dev, &dev_attr_product); + if (retval) + goto error; + } + if (udev->serial) { + retval = device_create_file (dev, &dev_attr_serial); + if (retval) + goto error; + } + retval = usb_create_ep_files(dev, &udev->ep0, udev); + if (retval) + goto error; + return 0; +error: + usb_remove_ep_files(&udev->ep0); + device_remove_file(dev, &dev_attr_manufacturer); + device_remove_file(dev, &dev_attr_product); + device_remove_file(dev, &dev_attr_serial); + return retval; } void usb_remove_sysfs_dev_files (struct usb_device *udev) @@ -339,18 +360,28 @@ static inline void usb_remove_intf_ep_files(struct usb_interface *intf) usb_remove_ep_files(&iface_desc->endpoint[i]); } -void usb_create_sysfs_intf_files (struct usb_interface *intf) +int usb_create_sysfs_intf_files(struct usb_interface *intf) { struct usb_device *udev = interface_to_usbdev(intf); struct usb_host_interface *alt = intf->cur_altsetting; + int retval; - sysfs_create_group(&intf->dev.kobj, &intf_attr_grp); + retval = sysfs_create_group(&intf->dev.kobj, &intf_attr_grp); + if (retval) + goto error; if (alt->string == NULL) alt->string = usb_cache_string(udev, alt->desc.iInterface); if (alt->string) - device_create_file(&intf->dev, &dev_attr_interface); + retval = device_create_file(&intf->dev, &dev_attr_interface); usb_create_intf_ep_files(intf, udev); + return 0; +error: + if (alt->string) + device_remove_file(&intf->dev, &dev_attr_interface); + sysfs_remove_group(&intf->dev.kobj, &intf_attr_grp); + usb_remove_intf_ep_files(intf); + return retval; } void usb_remove_sysfs_intf_files (struct usb_interface *intf) diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index 6b029cdb8671..60ef4ef0101a 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c @@ -147,11 +147,13 @@ static int __find_interface(struct device * dev, void * data) struct usb_interface *usb_find_interface(struct usb_driver *drv, int minor) { struct find_interface_arg argb; + int retval; argb.minor = minor; argb.interface = NULL; - driver_for_each_device(&drv->drvwrap.driver, NULL, &argb, - __find_interface); + /* eat the error, it will be in argb.interface */ + retval = driver_for_each_device(&drv->drvwrap.driver, NULL, &argb, + __find_interface); return argb.interface; } diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h index e8bc2e48913a..0c09ecced6e1 100644 --- a/drivers/usb/core/usb.h +++ b/drivers/usb/core/usb.h @@ -1,10 +1,10 @@ /* Functions local to drivers/usb/core/ */ -extern void usb_create_sysfs_dev_files (struct usb_device *dev); +extern int usb_create_sysfs_dev_files (struct usb_device *dev); extern void usb_remove_sysfs_dev_files (struct usb_device *dev); -extern void usb_create_sysfs_intf_files (struct usb_interface *intf); +extern int usb_create_sysfs_intf_files (struct usb_interface *intf); extern void usb_remove_sysfs_intf_files (struct usb_interface *intf); -extern void usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint, +extern int usb_create_ep_files(struct device *parent, struct usb_host_endpoint *endpoint, struct usb_device *udev); extern void usb_remove_ep_files(struct usb_host_endpoint *endpoint); |