Commit 92dfbdbc authored by Jingoo Han's avatar Jingoo Han Committed by Mark Brown

regulator: db8500-prcmu: use devm_regulator_register()

Use devm_regulator_register() to make cleanup paths simpler.
Signed-off-by: default avatarJingoo Han <jg1.han@samsung.com>
Acked-by: default avatarBengt Jonsson <bengt.g.jonsson@stericsson.com>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 6ce4eac1
......@@ -431,17 +431,11 @@ static int db8500_regulator_register(struct platform_device *pdev,
config.of_node = np;
/* register with the regulator framework */
info->rdev = regulator_register(&info->desc, &config);
info->rdev = devm_regulator_register(&pdev->dev, &info->desc, &config);
if (IS_ERR(info->rdev)) {
err = PTR_ERR(info->rdev);
dev_err(&pdev->dev, "failed to register %s: err %i\n",
info->desc.name, err);
/* if failing, unregister all earlier regulators */
while (--id >= 0) {
info = &dbx500_regulator_info[id];
regulator_unregister(info->rdev);
}
return err;
}
......@@ -530,20 +524,8 @@ static int db8500_regulator_probe(struct platform_device *pdev)
static int db8500_regulator_remove(struct platform_device *pdev)
{
int i;
ux500_regulator_debug_exit();
for (i = 0; i < ARRAY_SIZE(dbx500_regulator_info); i++) {
struct dbx500_regulator_info *info;
info = &dbx500_regulator_info[i];
dev_vdbg(rdev_get_dev(info->rdev),
"regulator-%s-remove\n", info->desc.name);
regulator_unregister(info->rdev);
}
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