aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max8907-regulator.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/max8907-regulator.c')
-rw-r--r--drivers/regulator/max8907-regulator.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c
index 4568c15fa78d..0c5fe6c6ac26 100644
--- a/drivers/regulator/max8907-regulator.c
+++ b/drivers/regulator/max8907-regulator.c
@@ -350,33 +350,17 @@ static int max8907_regulator_probe(struct platform_device *pdev)
350 pmic->desc[i].ops = &max8907_out5v_hwctl_ops; 350 pmic->desc[i].ops = &max8907_out5v_hwctl_ops;
351 } 351 }
352 352
353 pmic->rdev[i] = regulator_register(&pmic->desc[i], &config); 353 pmic->rdev[i] = devm_regulator_register(&pdev->dev,
354 &pmic->desc[i], &config);
354 if (IS_ERR(pmic->rdev[i])) { 355 if (IS_ERR(pmic->rdev[i])) {
355 dev_err(&pdev->dev, 356 dev_err(&pdev->dev,
356 "failed to register %s regulator\n", 357 "failed to register %s regulator\n",
357 pmic->desc[i].name); 358 pmic->desc[i].name);
358 ret = PTR_ERR(pmic->rdev[i]); 359 return PTR_ERR(pmic->rdev[i]);
359 goto err_unregister_regulator;
360 } 360 }
361 } 361 }
362 362
363 return 0; 363 return 0;
364
365err_unregister_regulator:
366 while (--i >= 0)
367 regulator_unregister(pmic->rdev[i]);
368 return ret;
369}
370
371static int max8907_regulator_remove(struct platform_device *pdev)
372{
373 struct max8907_regulator *pmic = platform_get_drvdata(pdev);
374 int i;
375
376 for (i = 0; i < MAX8907_NUM_REGULATORS; i++)
377 regulator_unregister(pmic->rdev[i]);
378
379 return 0;
380} 364}
381 365
382static struct platform_driver max8907_regulator_driver = { 366static struct platform_driver max8907_regulator_driver = {
@@ -385,7 +369,6 @@ static struct platform_driver max8907_regulator_driver = {
385 .owner = THIS_MODULE, 369 .owner = THIS_MODULE,
386 }, 370 },
387 .probe = max8907_regulator_probe, 371 .probe = max8907_regulator_probe,
388 .remove = max8907_regulator_remove,
389}; 372};
390 373
391static int __init max8907_regulator_init(void) 374static int __init max8907_regulator_init(void)