aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator/tps65910-regulator.c
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@gmail.com>2012-04-11 14:40:18 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-04-11 10:16:50 +0100
commit9eb0c4218aa444f863e7f54909351d5b4f0fac06 (patch)
treebcb7413f475d7e67d93d3bb1826f2eb3ef7479b1 /drivers/regulator/tps65910-regulator.c
parentd914d81b74fd4e91aed334c3f664be4b94364ee8 (diff)
regulator: Convert tps65xxx regulator drivers to 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/tps65910-regulator.c')
-rw-r--r--drivers/regulator/tps65910-regulator.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/regulator/tps65910-regulator.c b/drivers/regulator/tps65910-regulator.c
index e7a4ece1062..fe66a2c43fd 100644
--- a/drivers/regulator/tps65910-regulator.c
+++ b/drivers/regulator/tps65910-regulator.c
@@ -1109,7 +1109,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
if (!pmic_plat_data)
return -EINVAL;
- pmic = kzalloc(sizeof(*pmic), GFP_KERNEL);
+ pmic = devm_kzalloc(&pdev->dev, sizeof(*pmic), GFP_KERNEL);
if (!pmic)
return -ENOMEM;
@@ -1136,7 +1136,6 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
break;
default:
pr_err("Invalid tps chip version\n");
- kfree(pmic);
return -ENODEV;
}
@@ -1144,7 +1143,7 @@ static __devinit int tps65910_probe(struct platform_device *pdev)
sizeof(struct regulator_desc), GFP_KERNEL);
if (!pmic->desc) {
err = -ENOMEM;
- goto err_free_pmic;
+ goto err_out;
}
pmic->info = kcalloc(pmic->num_regulators,
@@ -1233,8 +1232,7 @@ err_free_info:
kfree(pmic->info);
err_free_desc:
kfree(pmic->desc);
-err_free_pmic:
- kfree(pmic);
+err_out:
return err;
}
@@ -1249,7 +1247,6 @@ static int __devexit tps65910_remove(struct platform_device *pdev)
kfree(pmic->rdev);
kfree(pmic->info);
kfree(pmic->desc);
- kfree(pmic);
return 0;
}