regulator: wm8994: Convert to devm_kzalloc()
authorMark Brown <broonie@opensource.wolfsonmicro.com>
Thu, 16 Feb 2012 07:12:17 +0000 (23:12 -0800)
committerMark Brown <broonie@opensource.wolfsonmicro.com>
Sun, 11 Mar 2012 20:48:41 +0000 (20:48 +0000)
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/wm8994-regulator.c

index 435e335d6e67ae372054bcb697e773684ab40d3d..75ed402d9f43587553790bdf9b17f7aa15fc56b6 100644 (file)
@@ -241,7 +241,7 @@ static __devinit int wm8994_ldo_probe(struct platform_device *pdev)
        if (!pdata)
                return -ENODEV;
 
-       ldo = kzalloc(sizeof(struct wm8994_ldo), GFP_KERNEL);
+       ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm8994_ldo), GFP_KERNEL);
        if (ldo == NULL) {
                dev_err(&pdev->dev, "Unable to allocate private data\n");
                return -ENOMEM;
@@ -285,7 +285,6 @@ err_gpio:
        if (gpio_is_valid(ldo->enable))
                gpio_free(ldo->enable);
 err:
-       kfree(ldo);
        return ret;
 }
 
@@ -298,7 +297,6 @@ static __devexit int wm8994_ldo_remove(struct platform_device *pdev)
        regulator_unregister(ldo->regulator);
        if (gpio_is_valid(ldo->enable))
                gpio_free(ldo->enable);
-       kfree(ldo);
 
        return 0;
 }