]> git.proxmox.com Git - mirror_ubuntu-kernels.git/commitdiff
regulator: defer probe when trying to get voltage from unresolved supply
authorMichał Mirosław <mirq-linux@rere.qmqm.pl>
Mon, 2 Nov 2020 21:27:27 +0000 (22:27 +0100)
committerMark Brown <broonie@kernel.org>
Tue, 3 Nov 2020 13:19:01 +0000 (13:19 +0000)
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@vger.kernel.org
Signed-off-by: Michał Mirosław <mirq-linux@rere.qmqm.pl>
Reported-by: Ondřej Jirman <megous@megous.com>
Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
Tested-by: Ondřej Jirman <megous@megous.com>
Link: https://lore.kernel.org/r/a9041d68b4d35e4a2dd71629c8a6422662acb5ee.1604351936.git.mirq-linux@rere.qmqm.pl
Signed-off-by: Mark Brown <broonie@kernel.org>
drivers/regulator/core.c

index a4ffd71696da67782f11b3fce1648f60c2cfa8fb..a5ad553da8cd4972f963a46deab46401e3d5f2cf 100644 (file)
@@ -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;
        }