diff options
author | Mark Brown <broonie@kernel.org> | 2016-04-22 11:38:42 +0100 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2016-04-22 11:38:42 +0100 |
commit | f89ba3383ee69e2e1473e41ed42614fc7c9d9192 (patch) | |
tree | 716c2d2cc4923a3003cb8292afa37bb664ff1ed9 /drivers/regulator/core.c | |
parent | 8e5356a73604f53da6a1e0756727cb8f9f7bba17 (diff) | |
parent | 469b640e4f4a28bdd50f0ac1d2b310907afb464c (diff) | |
download | linux-f89ba3383ee69e2e1473e41ed42614fc7c9d9192.tar.bz2 |
Merge branch 'topic/sysfs-init' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator into regulator-supply
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index bd9ec309b707..a17ce6cbbe77 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -3961,13 +3961,6 @@ regulator_register(const struct regulator_desc *regulator_desc, rdev->dev.parent = dev; dev_set_name(&rdev->dev, "regulator.%lu", (unsigned long) atomic_inc_return(®ulator_no)); - ret = device_register(&rdev->dev); - if (ret != 0) { - put_device(&rdev->dev); - goto wash; - } - - dev_set_drvdata(&rdev->dev, rdev); /* set regulator constraints */ if (init_data) @@ -3975,7 +3968,15 @@ regulator_register(const struct regulator_desc *regulator_desc, ret = set_machine_constraints(rdev, constraints); if (ret < 0) - goto scrub; + goto wash; + + ret = device_register(&rdev->dev); + if (ret != 0) { + put_device(&rdev->dev); + goto wash; + } + + dev_set_drvdata(&rdev->dev, rdev); if (init_data && init_data->supply_regulator) rdev->supply_name = init_data->supply_regulator; @@ -4007,14 +4008,13 @@ regulator_register(const struct regulator_desc *regulator_desc, unset_supplies: unset_regulator_supplies(rdev); - -scrub: regulator_ena_gpio_free(rdev); device_unregister(&rdev->dev); /* device core frees rdev */ goto out; wash: + kfree(rdev->constraints); regulator_ena_gpio_free(rdev); clean: kfree(rdev); |