[PATCH v1] regulator: defer probe when trying to get voltage from unresolved supply
Michał Mirosław
mirq-linux at rere.qmqm.pl
Mon Nov 2 16:27:27 EST 2020
regulator_get_voltage_rdev() is called in regulator probe() when
applying machine constraints. The "fixed" commit exposed the problem
that non-bypassed regulators can forward the request to its parent
(like bypassed ones) supply. Return -EPROBE_DEFER when the supply
is expected but not resolved yet.
Fixes: aea6cb99703e ("regulator: resolve supply after creating regulator")
Cc: stable at vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux at rere.qmqm.pl>
Reported-by: Ondřej Jirman <megous at megous.com>
Reported-by: Corentin Labbe <clabbe.montjoie at gmail.com>
---
v1: this is a bit different solution than the hack sent earlier. It should
be equivalent (putting the error code at the source), but please
test again.
---
drivers/regulator/core.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a4ffd71696da..a5ad553da8cd 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -4165,6 +4165,8 @@ int regulator_get_voltage_rdev(struct regulator_dev *rdev)
ret = rdev->desc->fixed_uV;
} else if (rdev->supply) {
ret = regulator_get_voltage_rdev(rdev->supply->rdev);
+ } else if (rdev->supply_name) {
+ return -EPROBE_DEFER;
} else {
return -EINVAL;
}
--
2.20.1
More information about the linux-arm-kernel
mailing list