leds: leds-cobalt-qube: Use devm_led_classdev_register
authorVaishali Thakkar <vthakkar1994@gmail.com>
Fri, 4 Sep 2015 10:12:01 +0000 (12:12 +0200)
committerJacek Anaszewski <j.anaszewski@samsung.com>
Tue, 3 Nov 2015 07:59:09 +0000 (08:59 +0100)
Use resource-managed function devm_led_classdev_register instead
of led_classdev_register to make the error-path simpler.

To be compatible with the change, goto is replaced with direct
return, unneeded label err_null is dropped and unnecessary variable
retval is removed. Also, remove redundant cobalt_qube_led_remove.

Signed-off-by: Vaishali Thakkar <vthakkar1994@gmail.com>
Signed-off-by: Jacek Anaszewski <j.anaszewski@samsung.com>
drivers/leds/leds-cobalt-qube.c

index d975220804916c9f35c734b9b4db212e36389f0a..9be195707b392d0c9dd8ca0da5f4633553342de0 100644 (file)
@@ -36,7 +36,6 @@ static struct led_classdev qube_front_led = {
 static int cobalt_qube_led_probe(struct platform_device *pdev)
 {
        struct resource *res;
-       int retval;
 
        res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
        if (!res)
@@ -49,31 +48,11 @@ static int cobalt_qube_led_probe(struct platform_device *pdev)
        led_value = LED_FRONT_LEFT | LED_FRONT_RIGHT;
        writeb(led_value, led_port);
 
-       retval = led_classdev_register(&pdev->dev, &qube_front_led);
-       if (retval)
-               goto err_null;
-
-       return 0;
-
-err_null:
-       led_port = NULL;
-
-       return retval;
-}
-
-static int cobalt_qube_led_remove(struct platform_device *pdev)
-{
-       led_classdev_unregister(&qube_front_led);
-
-       if (led_port)
-               led_port = NULL;
-
-       return 0;
+       return devm_led_classdev_register(&pdev->dev, &qube_front_led);
 }
 
 static struct platform_driver cobalt_qube_led_driver = {
        .probe  = cobalt_qube_led_probe,
-       .remove = cobalt_qube_led_remove,
        .driver = {
                .name   = "cobalt-qube-leds",
        },