From fded2f4faee7670b0545ac05bd2b3ed6b9afcda2 Mon Sep 17 00:00:00 2001 From: Mark Brown Date: Thu, 15 Dec 2011 02:11:14 +0800 Subject: regulator: Convert wm831x regulator drivers to devm_kzalloc() Signed-off-by: Mark Brown --- drivers/regulator/wm831x-dcdc.c | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'drivers/regulator/wm831x-dcdc.c') diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 7558a9666a5..4904a40b0d4 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c @@ -511,7 +511,8 @@ static __devinit int wm831x_buckv_probe(struct platform_device *pdev) if (pdata == NULL || pdata->dcdc[id] == NULL) return -ENODEV; - dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); + dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), + GFP_KERNEL); if (dcdc == NULL) { dev_err(&pdev->dev, "Unable to allocate private data\n"); return -ENOMEM; @@ -590,7 +591,6 @@ err_regulator: err: if (dcdc->dvs_gpio) gpio_free(dcdc->dvs_gpio); - kfree(dcdc); return ret; } @@ -605,7 +605,6 @@ static __devexit int wm831x_buckv_remove(struct platform_device *pdev) regulator_unregister(dcdc->regulator); if (dcdc->dvs_gpio) gpio_free(dcdc->dvs_gpio); - kfree(dcdc); return 0; } @@ -722,7 +721,8 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) if (pdata == NULL || pdata->dcdc[id] == NULL) return -ENODEV; - dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); + dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), + GFP_KERNEL); if (dcdc == NULL) { dev_err(&pdev->dev, "Unable to allocate private data\n"); return -ENOMEM; @@ -771,7 +771,6 @@ static __devinit int wm831x_buckp_probe(struct platform_device *pdev) err_regulator: regulator_unregister(dcdc->regulator); err: - kfree(dcdc); return ret; } @@ -783,7 +782,6 @@ static __devexit int wm831x_buckp_remove(struct platform_device *pdev) free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); regulator_unregister(dcdc->regulator); - kfree(dcdc); return 0; } -- cgit v1.2.3