aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAndrew Lunn <andrew@lunn.ch>2012-10-28 11:01:11 -0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-10-28 14:13:07 -0400
commitb2da55d9441cbdaf73c12403ed801b644d5ae5e3 (patch)
treec8976cbd52aabcba45a51c898fe11672200cb97f /drivers/regulator
parent6f0c0580b70c89094b3422ba81118c7b959c7556 (diff)
Regulator: core: Unregister when gpio request fails.
If the gpio_request_one() fails, or returns EPROBE_DEFER, the regulator must be device_unregister()ed. When this is not done, there are WARNING: from sysfs: WARNING: at fs/sysfs/file.c:343 sysfs_open_file+0x238/0x268() Signed-off-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 5c4829cba6a..aa4d28b5984 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -3365,7 +3365,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
3365 if (ret != 0) { 3365 if (ret != 0) {
3366 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n", 3366 rdev_err(rdev, "Failed to request enable GPIO%d: %d\n",
3367 config->ena_gpio, ret); 3367 config->ena_gpio, ret);
3368 goto clean; 3368 goto wash;
3369 } 3369 }
3370 3370
3371 rdev->ena_gpio = config->ena_gpio; 3371 rdev->ena_gpio = config->ena_gpio;
@@ -3449,6 +3449,7 @@ scrub:
3449 if (rdev->ena_gpio) 3449 if (rdev->ena_gpio)
3450 gpio_free(rdev->ena_gpio); 3450 gpio_free(rdev->ena_gpio);
3451 kfree(rdev->constraints); 3451 kfree(rdev->constraints);
3452wash:
3452 device_unregister(&rdev->dev); 3453 device_unregister(&rdev->dev);
3453 /* device core frees rdev */ 3454 /* device core frees rdev */
3454 rdev = ERR_PTR(ret); 3455 rdev = ERR_PTR(ret);