Commit e9aadb86 authored by Fida Mohammad's avatar Fida Mohammad Committed by Jacek Anaszewski

leds: leds-wrap.c: Use devm_led_classdev_register

Use of resource managed function devm_led_classdev_register to
make initialization path simpler. Also removed redundant remove
function.
Signed-off-by: default avatarFida Mohammad <fmthoker@gmail.com>
Signed-off-by: default avatarJacek Anaszewski <j.anaszewski@samsung.com>
parent 10238adb
...@@ -76,39 +76,19 @@ static int wrap_led_probe(struct platform_device *pdev) ...@@ -76,39 +76,19 @@ static int wrap_led_probe(struct platform_device *pdev)
{ {
int ret; int ret;
ret = led_classdev_register(&pdev->dev, &wrap_power_led); ret = devm_led_classdev_register(&pdev->dev, &wrap_power_led);
if (ret < 0) if (ret < 0)
return ret; return ret;
ret = led_classdev_register(&pdev->dev, &wrap_error_led); ret = devm_led_classdev_register(&pdev->dev, &wrap_error_led);
if (ret < 0) if (ret < 0)
goto err1; return ret;
ret = led_classdev_register(&pdev->dev, &wrap_extra_led);
if (ret < 0)
goto err2;
return ret;
err2:
led_classdev_unregister(&wrap_error_led);
err1:
led_classdev_unregister(&wrap_power_led);
return ret;
}
static int wrap_led_remove(struct platform_device *pdev) return devm_led_classdev_register(&pdev->dev, &wrap_extra_led);
{
led_classdev_unregister(&wrap_power_led);
led_classdev_unregister(&wrap_error_led);
led_classdev_unregister(&wrap_extra_led);
return 0;
} }
static struct platform_driver wrap_led_driver = { static struct platform_driver wrap_led_driver = {
.probe = wrap_led_probe, .probe = wrap_led_probe,
.remove = wrap_led_remove,
.driver = { .driver = {
.name = DRVNAME, .name = DRVNAME,
}, },
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment