summaryrefslogtreecommitdiff
path: root/drivers/leds/leds-cobalt-qube.c
diff options
context:
space:
mode:
authorVaishali Thakkar <vthakkar1994@gmail.com>2015-09-04 13:12:01 +0300
committerJacek Anaszewski <j.anaszewski@samsung.com>2015-11-03 10:59:09 +0300
commitaa4e2524955971730ff845c0589f2f8f441ad610 (patch)
tree6d26c2b5bf1f2f3f47aa261f56e6ac12a9b20061 /drivers/leds/leds-cobalt-qube.c
parent6a13feb9c82803e2b815eca72fa7a9f5561d7861 (diff)
downloadlinux-aa4e2524955971730ff845c0589f2f8f441ad610.tar.xz
leds: leds-cobalt-qube: Use devm_led_classdev_register
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>
Diffstat (limited to 'drivers/leds/leds-cobalt-qube.c')
-rw-r--r--drivers/leds/leds-cobalt-qube.c23
1 files changed, 1 insertions, 22 deletions
diff --git a/drivers/leds/leds-cobalt-qube.c b/drivers/leds/leds-cobalt-qube.c
index d97522080491..9be195707b39 100644
--- a/drivers/leds/leds-cobalt-qube.c
+++ b/drivers/leds/leds-cobalt-qube.c
@@ -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",
},