aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/wm831x-ldo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/wm831x-ldo.c')
-rw-r--r--drivers/regulator/wm831x-ldo.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/drivers/regulator/wm831x-ldo.c b/drivers/regulator/wm831x-ldo.c
index 5e96a2386b1d..f1e4ab0f9fda 100644
--- a/drivers/regulator/wm831x-ldo.c
+++ b/drivers/regulator/wm831x-ldo.c
@@ -326,7 +326,7 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
326 if (pdata == NULL || pdata->ldo[id] == NULL) 326 if (pdata == NULL || pdata->ldo[id] == NULL)
327 return -ENODEV; 327 return -ENODEV;
328 328
329 ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL); 329 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
330 if (ldo == NULL) { 330 if (ldo == NULL) {
331 dev_err(&pdev->dev, "Unable to allocate private data\n"); 331 dev_err(&pdev->dev, "Unable to allocate private data\n");
332 return -ENOMEM; 332 return -ENOMEM;
@@ -376,7 +376,6 @@ static __devinit int wm831x_gp_ldo_probe(struct platform_device *pdev)
376err_regulator: 376err_regulator:
377 regulator_unregister(ldo->regulator); 377 regulator_unregister(ldo->regulator);
378err: 378err:
379 kfree(ldo);
380 return ret; 379 return ret;
381} 380}
382 381
@@ -388,7 +387,6 @@ static __devexit int wm831x_gp_ldo_remove(struct platform_device *pdev)
388 387
389 free_irq(platform_get_irq_byname(pdev, "UV"), ldo); 388 free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
390 regulator_unregister(ldo->regulator); 389 regulator_unregister(ldo->regulator);
391 kfree(ldo);
392 390
393 return 0; 391 return 0;
394} 392}
@@ -596,7 +594,7 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
596 if (pdata == NULL || pdata->ldo[id] == NULL) 594 if (pdata == NULL || pdata->ldo[id] == NULL)
597 return -ENODEV; 595 return -ENODEV;
598 596
599 ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL); 597 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
600 if (ldo == NULL) { 598 if (ldo == NULL) {
601 dev_err(&pdev->dev, "Unable to allocate private data\n"); 599 dev_err(&pdev->dev, "Unable to allocate private data\n");
602 return -ENOMEM; 600 return -ENOMEM;
@@ -645,7 +643,6 @@ static __devinit int wm831x_aldo_probe(struct platform_device *pdev)
645err_regulator: 643err_regulator:
646 regulator_unregister(ldo->regulator); 644 regulator_unregister(ldo->regulator);
647err: 645err:
648 kfree(ldo);
649 return ret; 646 return ret;
650} 647}
651 648
@@ -655,7 +652,6 @@ static __devexit int wm831x_aldo_remove(struct platform_device *pdev)
655 652
656 free_irq(platform_get_irq_byname(pdev, "UV"), ldo); 653 free_irq(platform_get_irq_byname(pdev, "UV"), ldo);
657 regulator_unregister(ldo->regulator); 654 regulator_unregister(ldo->regulator);
658 kfree(ldo);
659 655
660 return 0; 656 return 0;
661} 657}
@@ -793,7 +789,7 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
793 if (pdata == NULL || pdata->ldo[id] == NULL) 789 if (pdata == NULL || pdata->ldo[id] == NULL)
794 return -ENODEV; 790 return -ENODEV;
795 791
796 ldo = kzalloc(sizeof(struct wm831x_ldo), GFP_KERNEL); 792 ldo = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_ldo), GFP_KERNEL);
797 if (ldo == NULL) { 793 if (ldo == NULL) {
798 dev_err(&pdev->dev, "Unable to allocate private data\n"); 794 dev_err(&pdev->dev, "Unable to allocate private data\n");
799 return -ENOMEM; 795 return -ENOMEM;
@@ -831,7 +827,6 @@ static __devinit int wm831x_alive_ldo_probe(struct platform_device *pdev)
831 return 0; 827 return 0;
832 828
833err: 829err:
834 kfree(ldo);
835 return ret; 830 return ret;
836} 831}
837 832
@@ -840,7 +835,6 @@ static __devexit int wm831x_alive_ldo_remove(struct platform_device *pdev)
840 struct wm831x_ldo *ldo = platform_get_drvdata(pdev); 835 struct wm831x_ldo *ldo = platform_get_drvdata(pdev);
841 836
842 regulator_unregister(ldo->regulator); 837 regulator_unregister(ldo->regulator);
843 kfree(ldo);
844 838
845 return 0; 839 return 0;
846} 840}