]> err.no Git - linux-2.6/commitdiff
USB: fix __must_check warnings in drivers/usb/misc/
authorGreg Kroah-Hartman <gregkh@suse.de>
Mon, 28 Aug 2006 18:43:25 +0000 (11:43 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Wed, 27 Sep 2006 18:58:58 +0000 (11:58 -0700)
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/misc/cypress_cy7c63.c
drivers/usb/misc/cytherm.c
drivers/usb/misc/usbled.c

index 9c46746d5d002ab0881918e39ab363f71a4fb926..b63b5f34b2aa5f0f79b7103c9e14ce9e89f2b2a7 100644 (file)
@@ -209,7 +209,7 @@ static int cypress_probe(struct usb_interface *interface,
        dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL) {
                dev_err(&interface->dev, "Out of memory!\n");
-               goto error;
+               goto error_mem;
        }
 
        dev->udev = usb_get_dev(interface_to_usbdev(interface));
@@ -218,15 +218,26 @@ static int cypress_probe(struct usb_interface *interface,
        usb_set_intfdata(interface, dev);
 
        /* create device attribute files */
-       device_create_file(&interface->dev, &dev_attr_port0);
-       device_create_file(&interface->dev, &dev_attr_port1);
+       retval = device_create_file(&interface->dev, &dev_attr_port0);
+       if (retval)
+               goto error;
+       retval = device_create_file(&interface->dev, &dev_attr_port1);
+       if (retval)
+               goto error;
 
        /* let the user know that the device is now attached */
        dev_info(&interface->dev,
                 "Cypress CY7C63xxx device now attached\n");
+       return 0;
 
-       retval = 0;
 error:
+       device_remove_file(&interface->dev, &dev_attr_port0);
+       device_remove_file(&interface->dev, &dev_attr_port1);
+       usb_set_intfdata(interface, NULL);
+       usb_put_dev(dev->udev);
+       kfree(dev);
+
+error_mem:
        return retval;
 }
 
index b20bec445552007b23d0008bc6998a3f717244af..04e87acd6e46007cec2449ffe34c58257d55c6a8 100644 (file)
@@ -353,7 +353,7 @@ static int cytherm_probe(struct usb_interface *interface,
        dev = kzalloc (sizeof(struct usb_cytherm), GFP_KERNEL);
        if (dev == NULL) {
                dev_err (&interface->dev, "Out of memory\n");
-               goto error;
+               goto error_mem;
        }
 
        dev->udev = usb_get_dev(udev);
@@ -362,18 +362,35 @@ static int cytherm_probe(struct usb_interface *interface,
 
        dev->brightness = 0xFF;
 
-       device_create_file(&interface->dev, &dev_attr_brightness);   
-       device_create_file(&interface->dev, &dev_attr_temp);
-       device_create_file(&interface->dev, &dev_attr_button);
-       device_create_file(&interface->dev, &dev_attr_port0);
-       device_create_file(&interface->dev, &dev_attr_port1);
+       retval = device_create_file(&interface->dev, &dev_attr_brightness);
+       if (retval)
+               goto error;
+       retval = device_create_file(&interface->dev, &dev_attr_temp);
+       if (retval)
+               goto error;
+       retval = device_create_file(&interface->dev, &dev_attr_button);
+       if (retval)
+               goto error;
+       retval = device_create_file(&interface->dev, &dev_attr_port0);
+       if (retval)
+               goto error;
+       retval = device_create_file(&interface->dev, &dev_attr_port1);
+       if (retval)
+               goto error;
 
-       dev_info (&interface->dev, 
+       dev_info (&interface->dev,
                  "Cypress thermometer device now attached\n");
        return 0;
-
- error:
+error:
+       device_remove_file(&interface->dev, &dev_attr_brightness);
+       device_remove_file(&interface->dev, &dev_attr_temp);
+       device_remove_file(&interface->dev, &dev_attr_button);
+       device_remove_file(&interface->dev, &dev_attr_port0);
+       device_remove_file(&interface->dev, &dev_attr_port1);
+       usb_set_intfdata (interface, NULL);
+       usb_put_dev(dev->udev);
        kfree(dev);
+error_mem:
        return retval;
 }
 
index 0c5ee0ad6bb952fecc1eda6708cbab753ebc4120..49c5c5c4c431ee2aabd7ce0b081e913d2634b6f6 100644 (file)
@@ -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;
 }