From: Fida Mohammad Date: Wed, 21 Oct 2015 10:58:35 +0000 (-0700) Subject: leds: leds-wrap.c: Use devm_led_classdev_register X-Git-Tag: v4.4-rc1~168^2~4 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=e9aadb864f04f1f7c7f8713fead64a2370be940d;p=profile%2Fwearable%2Fplatform%2Fkernel%2Flinux-4.9-exynos9110.git 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: Fida Mohammad Signed-off-by: Jacek Anaszewski --- diff --git a/drivers/leds/leds-wrap.c b/drivers/leds/leds-wrap.c index 1ba3def..473fb6b 100644 --- a/drivers/leds/leds-wrap.c +++ b/drivers/leds/leds-wrap.c @@ -76,39 +76,19 @@ static int wrap_led_probe(struct platform_device *pdev) { int ret; - ret = led_classdev_register(&pdev->dev, &wrap_power_led); + ret = devm_led_classdev_register(&pdev->dev, &wrap_power_led); if (ret < 0) return ret; - ret = led_classdev_register(&pdev->dev, &wrap_error_led); + ret = devm_led_classdev_register(&pdev->dev, &wrap_error_led); if (ret < 0) - goto err1; - - 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; -} + return ret; -static int wrap_led_remove(struct platform_device *pdev) -{ - led_classdev_unregister(&wrap_power_led); - led_classdev_unregister(&wrap_error_led); - led_classdev_unregister(&wrap_extra_led); - return 0; + return devm_led_classdev_register(&pdev->dev, &wrap_extra_led); } static struct platform_driver wrap_led_driver = { .probe = wrap_led_probe, - .remove = wrap_led_remove, .driver = { .name = DRVNAME, },