aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-03-23 05:00:01 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-01 06:59:30 -0400
commit4c60165dcb68f56e97b0a1b8f5233b3a486af353 (patch)
treeac7130009d4dbc93a2a99d6f1387b54f1f98cb16 /drivers/regulator
parent3cbff37ea0e9d90334c51ac92f5a597697258d3d (diff)
regulator: wm831x-dcdc: Use devm_kzalloc
Signed-off-by: Axel Lin <axel.lin@gmail.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/wm831x-dcdc.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 4904a40b0d46..909c53b70375 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -848,7 +848,7 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
848 if (pdata == NULL || pdata->dcdc[id] == NULL) 848 if (pdata == NULL || pdata->dcdc[id] == NULL)
849 return -ENODEV; 849 return -ENODEV;
850 850
851 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); 851 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
852 if (dcdc == NULL) { 852 if (dcdc == NULL) {
853 dev_err(&pdev->dev, "Unable to allocate private data\n"); 853 dev_err(&pdev->dev, "Unable to allocate private data\n");
854 return -ENOMEM; 854 return -ENOMEM;
@@ -897,7 +897,6 @@ static __devinit int wm831x_boostp_probe(struct platform_device *pdev)
897err_regulator: 897err_regulator:
898 regulator_unregister(dcdc->regulator); 898 regulator_unregister(dcdc->regulator);
899err: 899err:
900 kfree(dcdc);
901 return ret; 900 return ret;
902} 901}
903 902
@@ -909,7 +908,6 @@ static __devexit int wm831x_boostp_remove(struct platform_device *pdev)
909 908
910 free_irq(platform_get_irq_byname(pdev, "UV"), dcdc); 909 free_irq(platform_get_irq_byname(pdev, "UV"), dcdc);
911 regulator_unregister(dcdc->regulator); 910 regulator_unregister(dcdc->regulator);
912 kfree(dcdc);
913 911
914 return 0; 912 return 0;
915} 913}
@@ -952,7 +950,7 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
952 if (pdata == NULL || pdata->epe[id] == NULL) 950 if (pdata == NULL || pdata->epe[id] == NULL)
953 return -ENODEV; 951 return -ENODEV;
954 952
955 dcdc = kzalloc(sizeof(struct wm831x_dcdc), GFP_KERNEL); 953 dcdc = devm_kzalloc(&pdev->dev, sizeof(struct wm831x_dcdc), GFP_KERNEL);
956 if (dcdc == NULL) { 954 if (dcdc == NULL) {
957 dev_err(&pdev->dev, "Unable to allocate private data\n"); 955 dev_err(&pdev->dev, "Unable to allocate private data\n");
958 return -ENOMEM; 956 return -ENOMEM;
@@ -984,7 +982,6 @@ static __devinit int wm831x_epe_probe(struct platform_device *pdev)
984 return 0; 982 return 0;
985 983
986err: 984err:
987 kfree(dcdc);
988 return ret; 985 return ret;
989} 986}
990 987
@@ -993,9 +990,7 @@ static __devexit int wm831x_epe_remove(struct platform_device *pdev)
993 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); 990 struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
994 991
995 platform_set_drvdata(pdev, NULL); 992 platform_set_drvdata(pdev, NULL);
996
997 regulator_unregister(dcdc->regulator); 993 regulator_unregister(dcdc->regulator);
998 kfree(dcdc);
999 994
1000 return 0; 995 return 0;
1001} 996}