Commit 4c60165d authored by Axel Lin's avatar Axel Lin Committed by Mark Brown

regulator: wm831x-dcdc: Use devm_kzalloc

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 3cbff37e
...@@ -848,7 +848,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev) ...@@ -848,7 +848,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
if (pdata == NULL || pdata->dcdc[id] == NULL) if (pdata == NULL || pdata->dcdc[id] == NULL)
return -ENODEV; return -ENODEV;
dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
if (dcdc == NULL) { if (dcdc == NULL) {
dev_err(&pdev->dev, "Unable to allocate private data\n"); dev_err(&pdev->dev, "Unable to allocate private data\n");
return -ENOMEM; return -ENOMEM;
...@@ -897,7 +897,6 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev) ...@@ -897,7 +897,6 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
err_regulator: err_regulator:
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
err: err:
kfree(dcdc);
return ret; return ret;
} }
...@@ -909,7 +908,6 @@ static __devexit int wm831x_boostp_remove(struct platform_device *pdev) ...@@ -909,7 +908,6 @@ static __devexit int wm831x_boostp_remove(struct platform_device *pdev)
free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); free_irq(platform_get_irq_byname(pdev, "UV"), dcdc);
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
kfree(dcdc);
return 0; return 0;
} }
...@@ -952,7 +950,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev) ...@@ -952,7 +950,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
if (pdata == NULL || pdata->epe[id] == NULL) if (pdata == NULL || pdata->epe[id] == NULL)
return -ENODEV; return -ENODEV;
dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
if (dcdc == NULL) { if (dcdc == NULL) {
dev_err(&pdev->dev, "Unable to allocate private data\n"); dev_err(&pdev->dev, "Unable to allocate private data\n");
return -ENOMEM; return -ENOMEM;
...@@ -984,7 +982,6 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev) ...@@ -984,7 +982,6 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
return 0; return 0;
err: err:
kfree(dcdc);
return ret; return ret;
} }
...@@ -993,9 +990,7 @@ static __devexit int wm831x_epe_remove(struct platform_device *pdev) ...@@ -993,9 +990,7 @@ static __devexit int wm831x_epe_remove(struct platform_device *pdev)
struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
platform_set_drvdata(pdev, NULL); platform_set_drvdata(pdev, NULL);
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
kfree(dcdc);
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment