diff options
-rw-r--r-- | drivers/regulator/mc13783-regulator.c | 25 |
1 files changed, 4 insertions, 21 deletions
diff --git a/drivers/regulator/mc13783-regulator.c b/drivers/regulator/mc13783-regulator.c index 5ff99d2703db..f036b26d4cfc 100644 --- a/drivers/regulator/mc13783-regulator.c +++ b/drivers/regulator/mc13783-regulator.c | |||
@@ -400,7 +400,7 @@ static int mc13783_regulator_probe(struct platform_device *pdev) | |||
400 | dev_get_platdata(&pdev->dev); | 400 | dev_get_platdata(&pdev->dev); |
401 | struct mc13xxx_regulator_init_data *mc13xxx_data; | 401 | struct mc13xxx_regulator_init_data *mc13xxx_data; |
402 | struct regulator_config config = { }; | 402 | struct regulator_config config = { }; |
403 | int i, ret, num_regulators; | 403 | int i, num_regulators; |
404 | 404 | ||
405 | num_regulators = mc13xxx_get_num_regulators_dt(pdev); | 405 | num_regulators = mc13xxx_get_num_regulators_dt(pdev); |
406 | 406 | ||
@@ -444,32 +444,16 @@ static int mc13783_regulator_probe(struct platform_device *pdev) | |||
444 | config.driver_data = priv; | 444 | config.driver_data = priv; |
445 | config.of_node = node; | 445 | config.of_node = node; |
446 | 446 | ||
447 | priv->regulators[i] = regulator_register(desc, &config); | 447 | priv->regulators[i] = devm_regulator_register(&pdev->dev, desc, |
448 | &config); | ||
448 | if (IS_ERR(priv->regulators[i])) { | 449 | if (IS_ERR(priv->regulators[i])) { |
449 | dev_err(&pdev->dev, "failed to register regulator %s\n", | 450 | dev_err(&pdev->dev, "failed to register regulator %s\n", |
450 | mc13783_regulators[i].desc.name); | 451 | mc13783_regulators[i].desc.name); |
451 | ret = PTR_ERR(priv->regulators[i]); | 452 | return PTR_ERR(priv->regulators[i]); |
452 | goto err; | ||
453 | } | 453 | } |
454 | } | 454 | } |
455 | 455 | ||
456 | return 0; | 456 | return 0; |
457 | err: | ||
458 | while (--i >= 0) | ||
459 | regulator_unregister(priv->regulators[i]); | ||
460 | |||
461 | return ret; | ||
462 | } | ||
463 | |||
464 | static int mc13783_regulator_remove(struct platform_device *pdev) | ||
465 | { | ||
466 | struct mc13xxx_regulator_priv *priv = platform_get_drvdata(pdev); | ||
467 | int i; | ||
468 | |||
469 | for (i = 0; i < priv->num_regulators; i++) | ||
470 | regulator_unregister(priv->regulators[i]); | ||
471 | |||
472 | return 0; | ||
473 | } | 457 | } |
474 | 458 | ||
475 | static struct platform_driver mc13783_regulator_driver = { | 459 | static struct platform_driver mc13783_regulator_driver = { |
@@ -477,7 +461,6 @@ static struct platform_driver mc13783_regulator_driver = { | |||
477 | .name = "mc13783-regulator", | 461 | .name = "mc13783-regulator", |
478 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
479 | }, | 463 | }, |
480 | .remove = mc13783_regulator_remove, | ||
481 | .probe = mc13783_regulator_probe, | 464 | .probe = mc13783_regulator_probe, |
482 | }; | 465 | }; |
483 | 466 | ||