From: Mark Brown Date: Thu, 16 Feb 2012 07:12:17 +0000 (-0800) Subject: regulator: wm8994: Convert to devm_kzalloc() X-Git-Tag: v3.4-rc1~168^2~4^2~43 X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b9e0348f2051358318e5ef0fd5b91c4d335a370d;p=pandora-kernel.git regulator: wm8994: Convert to devm_kzalloc() Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 435e335d6e67..75ed402d9f43 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -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; }