aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator/max77686.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/regulator/max77686.c')
-rw-r--r--drivers/regulator/max77686.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/drivers/regulator/max77686.c b/drivers/regulator/max77686.c
index f563057e5690..ae001ccf26f4 100644
--- a/drivers/regulator/max77686.c
+++ b/drivers/regulator/max77686.c
@@ -478,32 +478,16 @@ static int max77686_pmic_probe(struct platform_device *pdev)
478 config.of_node = pdata->regulators[i].of_node; 478 config.of_node = pdata->regulators[i].of_node;
479 479
480 max77686->opmode[i] = regulators[i].enable_mask; 480 max77686->opmode[i] = regulators[i].enable_mask;
481 max77686->rdev[i] = regulator_register(&regulators[i], &config); 481 max77686->rdev[i] = devm_regulator_register(&pdev->dev,
482 &regulators[i], &config);
482 if (IS_ERR(max77686->rdev[i])) { 483 if (IS_ERR(max77686->rdev[i])) {
483 ret = PTR_ERR(max77686->rdev[i]);
484 dev_err(&pdev->dev, 484 dev_err(&pdev->dev,
485 "regulator init failed for %d\n", i); 485 "regulator init failed for %d\n", i);
486 max77686->rdev[i] = NULL; 486 return PTR_ERR(max77686->rdev[i]);
487 goto err;
488 } 487 }
489 } 488 }
490 489
491 return 0; 490 return 0;
492err:
493 while (--i >= 0)
494 regulator_unregister(max77686->rdev[i]);
495 return ret;
496}
497
498static int max77686_pmic_remove(struct platform_device *pdev)
499{
500 struct max77686_data *max77686 = platform_get_drvdata(pdev);
501 int i;
502
503 for (i = 0; i < MAX77686_REGULATORS; i++)
504 regulator_unregister(max77686->rdev[i]);
505
506 return 0;
507} 491}
508 492
509static const struct platform_device_id max77686_pmic_id[] = { 493static const struct platform_device_id max77686_pmic_id[] = {
@@ -518,7 +502,6 @@ static struct platform_driver max77686_pmic_driver = {
518 .owner = THIS_MODULE, 502 .owner = THIS_MODULE,
519 }, 503 },
520 .probe = max77686_pmic_probe, 504 .probe = max77686_pmic_probe,
521 .remove = max77686_pmic_remove,
522 .id_table = max77686_pmic_id, 505 .id_table = max77686_pmic_id,
523}; 506};
524 507