Use resource managed function devm_classdev_register to make
error path simpler. Also removed the redundant remove function.

Signed-off-by: Fida Mohammad <[email protected]>
---
 drivers/leds/leds-hp6xx.c | 15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/leds/leds-hp6xx.c b/drivers/leds/leds-hp6xx.c
index 0b84c01..ffb6d5b 100644
--- a/drivers/leds/leds-hp6xx.c
+++ b/drivers/leds/leds-hp6xx.c
@@ -59,28 +59,17 @@ static int hp6xxled_probe(struct platform_device *pdev)
 {
        int ret;
 
-       ret = led_classdev_register(&pdev->dev, &hp6xx_red_led);
+       ret = devm_led_classdev_register(&pdev->dev, &hp6xx_red_led);
        if (ret < 0)
                return ret;
 
-       ret = led_classdev_register(&pdev->dev, &hp6xx_green_led);
-       if (ret < 0)
-               led_classdev_unregister(&hp6xx_red_led);
+       return devm_led_classdev_register(&pdev->dev, &hp6xx_green_led);
 
-       return ret;
 }
 
-static int hp6xxled_remove(struct platform_device *pdev)
-{
-       led_classdev_unregister(&hp6xx_red_led);
-       led_classdev_unregister(&hp6xx_green_led);
-
-       return 0;
-}
 
 static struct platform_driver hp6xxled_driver = {
        .probe          = hp6xxled_probe,
-       .remove         = hp6xxled_remove,
        .driver         = {
                .name           = "hp6xx-led",
        },
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to