Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 23c3f310 authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown
Browse files

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: 6261b06d ("regulator: Defer lookup of supply to regulator_get")
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
Cc: stable@vger.kernel.org
parent 9f8df6ad
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -1394,6 +1394,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
		return 0;

	r = regulator_dev_lookup(dev, rdev->supply_name, &ret);
	if (!r) {
		if (ret == -ENODEV) {
			/*
			 * No supply was specified for this regulator and
@@ -1402,7 +1403,6 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
			return 0;
		}

	if (!r) {
		if (have_full_constraints()) {
			r = dummy_regulator_rdev;
		} else {