Skip to content

Commit

Permalink
regulator: core: Correct return value check in regulator_resolve_supply
Browse files Browse the repository at this point in the history
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: 6261b06 ("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
  • Loading branch information
Charles Keepax authored and Mark Brown committed Sep 17, 2015
1 parent 9f8df6a commit 23c3f31
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1394,15 +1394,15 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
return 0;

r = regulator_dev_lookup(dev, rdev->supply_name, &ret);
if (ret == -ENODEV) {
/*
* No supply was specified for this regulator and
* there will never be one.
*/
return 0;
}

if (!r) {
if (ret == -ENODEV) {
/*
* No supply was specified for this regulator and
* there will never be one.
*/
return 0;
}

if (have_full_constraints()) {
r = dummy_regulator_rdev;
} else {
Expand Down

0 comments on commit 23c3f31

Please sign in to comment.