aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorCharles Keepax <ckeepax@opensource.wolfsonmicro.com>2015-09-17 09:50:20 -0400
committerMark Brown <broonie@kernel.org>2015-09-17 13:39:56 -0400
commit23c3f310e897837aeb8ffe8700b803cb58e7b35d (patch)
treef50c03c0ba49f90d6ad8ca9d3ef6c90c68768c3f /drivers/regulator
parent9f8df6adf6c53abfa10e243cb289c34eb18ec581 (diff)
regulator: core: Correct return value check in regulator_resolve_supply
The ret pointer passed to regulator_dev_lookup is only filled with a valid error code if regulator_dev_lookup returned NULL. Currently regulator_resolve_supply checks this ret value before it checks if a regulator was returned, this can result in valid regulator lookups being ignored. Fixes: 6261b06de565 ("regulator: Defer lookup of supply to regulator_get") Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 7150ff6ef46b..d0fbaea9bf54 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -1394,15 +1394,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
1394 return 0; 1394 return 0;
1395 1395
1396 r = regulator_dev_lookup(dev, rdev->supply_name, &ret); 1396 r = regulator_dev_lookup(dev, rdev->supply_name, &ret);
1397 if (ret == -ENODEV) {
1398 /*
1399 * No supply was specified for this regulator and
1400 * there will never be one.
1401 */
1402 return 0;
1403 }
1404
1405 if (!r) { 1397 if (!r) {
1398 if (ret == -ENODEV) {
1399 /*
1400 * No supply was specified for this regulator and
1401 * there will never be one.
1402 */
1403 return 0;
1404 }
1405
1406 if (have_full_constraints()) { 1406 if (have_full_constraints()) {
1407 r = dummy_regulator_rdev; 1407 r = dummy_regulator_rdev;
1408 } else { 1408 } else {