]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/leds/leds-wm8350.c
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
[karo-tx-linux.git] / drivers / leds / leds-wm8350.c
index 4a1276578352283544ceb6fda2ff176d0772d887..918d4baff1c7257c65276bfcf4cb05b73350553c 100644 (file)
@@ -227,7 +227,7 @@ static int wm8350_led_probe(struct platform_device *pdev)
                goto err_isink;
        }
 
-       led = kzalloc(sizeof(*led), GFP_KERNEL);
+       led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
        if (led == NULL) {
                ret = -ENOMEM;
                goto err_dcdc;
@@ -259,12 +259,10 @@ static int wm8350_led_probe(struct platform_device *pdev)
 
        ret = led_classdev_register(&pdev->dev, &led->cdev);
        if (ret < 0)
-               goto err_led;
+               goto err_dcdc;
 
        return 0;
 
- err_led:
-       kfree(led);
  err_dcdc:
        regulator_put(dcdc);
  err_isink:
@@ -281,7 +279,6 @@ static int wm8350_led_remove(struct platform_device *pdev)
        wm8350_led_disable(led);
        regulator_put(led->dcdc);
        regulator_put(led->isink);
-       kfree(led);
        return 0;
 }
 
@@ -295,17 +292,7 @@ static struct platform_driver wm8350_led_driver = {
        .shutdown = wm8350_led_shutdown,
 };
 
-static int __devinit wm8350_led_init(void)
-{
-       return platform_driver_register(&wm8350_led_driver);
-}
-module_init(wm8350_led_init);
-
-static void wm8350_led_exit(void)
-{
-       platform_driver_unregister(&wm8350_led_driver);
-}
-module_exit(wm8350_led_exit);
+module_platform_driver(wm8350_led_driver);
 
 MODULE_AUTHOR("Mark Brown");
 MODULE_DESCRIPTION("WM8350 LED driver");