diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2006-08-28 11:43:25 -0700 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2006-09-27 11:58:57 -0700 |
commit | 1b21d5e166e104f8914441ef52e2cd50ce65b479 (patch) | |
tree | e3139ee35d16be051d3dd01688bc29ec2afc7315 /drivers/usb/core/sysfs.c | |
parent | 592fbbe4bc339399d363dd55f0391e0623400706 (diff) |
USB: fix __must_check warnings in drivers/usb/core/
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/core/sysfs.c')
-rw-r--r-- | drivers/usb/core/sysfs.c | 55 |
1 files changed, 43 insertions, 12 deletions
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index cd2286246f6..55d8f575206 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) |