summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2016-03-13 15:19:22 +0700
committerMark Brown <broonie@kernel.org>2016-03-13 15:19:22 +0700
commitc155e0ab13fa6b318a026a7f5d3ee15ed7aba571 (patch)
treedbc82fac633573b29f8f92f9264a5573d147febb /drivers/regulator
parent905373b6377394ae6819574ed3c170632c8bab59 (diff)
parent32165230eb6e629d7f88e66e0bd90a201549de53 (diff)
Merge remote-tracking branch 'regulator/topic/core' into regulator-next
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 4405be13eb0e..055f8c1a83a8 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3913,6 +3913,16 @@ regulator_register(const struct regulator_desc *regulator_desc,
goto clean;
}
+ if ((config->ena_gpio || config->ena_gpio_initialized) &&
+ gpio_is_valid(config->ena_gpio)) {
+ ret = regulator_ena_gpio_request(rdev, config);
+ if (ret != 0) {
+ rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
+ config->ena_gpio, ret);
+ goto clean;
+ }
+ }
+
/* register with sysfs */
rdev->dev.class = &regulator_class;
rdev->dev.parent = dev;
@@ -3921,21 +3931,11 @@ regulator_register(const struct regulator_desc *regulator_desc,
ret = device_register(&rdev->dev);
if (ret != 0) {
put_device(&rdev->dev);
- goto clean;
+ goto wash;
}
dev_set_drvdata(&rdev->dev, rdev);
- if ((config->ena_gpio || config->ena_gpio_initialized) &&
- gpio_is_valid(config->ena_gpio)) {
- ret = regulator_ena_gpio_request(rdev, config);
- if (ret != 0) {
- rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
- config->ena_gpio, ret);
- goto wash;
- }
- }
-
/* set regulator constraints */
if (init_data)
constraints = &init_data->constraints;
@@ -3974,13 +3974,13 @@ unset_supplies:
scrub:
regulator_ena_gpio_free(rdev);
-
-wash:
device_unregister(&rdev->dev);
/* device core frees rdev */
rdev = ERR_PTR(ret);
goto out;
+wash:
+ regulator_ena_gpio_free(rdev);
clean:
kfree(rdev);
rdev = ERR_PTR(ret);