summaryrefslogtreecommitdiff
path: root/drivers/usb/misc/usbled.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2006-08-28 22:43:25 +0400
committerGreg Kroah-Hartman <gregkh@suse.de>2006-09-27 22:58:58 +0400
commit4d42e1bb9e8ec7eb5e39d82aaf3ff2f3c994af84 (patch)
tree1316e32df6772e99221a9b88cbcc6f60abfc3f54 /drivers/usb/misc/usbled.c
parent1b21d5e166e104f8914441ef52e2cd50ce65b479 (diff)
downloadlinux-4d42e1bb9e8ec7eb5e39d82aaf3ff2f3c994af84.tar.xz
USB: fix __must_check warnings in drivers/usb/misc/
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/misc/usbled.c')
-rw-r--r--drivers/usb/misc/usbled.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c
index 0c5ee0ad6bb9..49c5c5c4c431 100644
--- a/drivers/usb/misc/usbled.c
+++ b/drivers/usb/misc/usbled.c
@@ -108,22 +108,34 @@ static int led_probe(struct usb_interface *interface, const struct usb_device_id
dev = kzalloc(sizeof(struct usb_led), GFP_KERNEL);
if (dev == NULL) {
dev_err(&interface->dev, "Out of memory\n");
- goto error;
+ goto error_mem;
}
dev->udev = usb_get_dev(udev);
usb_set_intfdata (interface, dev);
- device_create_file(&interface->dev, &dev_attr_blue);
- device_create_file(&interface->dev, &dev_attr_red);
- device_create_file(&interface->dev, &dev_attr_green);
+ retval = device_create_file(&interface->dev, &dev_attr_blue);
+ if (retval)
+ goto error;
+ retval = device_create_file(&interface->dev, &dev_attr_red);
+ if (retval)
+ goto error;
+ retval = device_create_file(&interface->dev, &dev_attr_green);
+ if (retval)
+ goto error;
dev_info(&interface->dev, "USB LED device now attached\n");
return 0;
error:
+ device_remove_file(&interface->dev, &dev_attr_blue);
+ device_remove_file(&interface->dev, &dev_attr_red);
+ device_remove_file(&interface->dev, &dev_attr_green);
+ usb_set_intfdata (interface, NULL);
+ usb_put_dev(dev->udev);
kfree(dev);
+error_mem:
return retval;
}