aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/regulator
diff options
context:
space:
mode:
authorPi-Hsun Shih <pihsun@chromium.org>2020-11-06 14:48:17 +0800
committerMark Brown <broonie@kernel.org>2020-11-10 17:27:42 +0000
commitc088a4985e5f6f6c2cbe5a6953357dfc30b7c57e (patch)
treedfec6e6cf41e9f64bffe6b07286c496757acfc68 /drivers/regulator
parentregulator: defer probe when trying to get voltage from unresolved supply (diff)
downloadlinux-dev-c088a4985e5f6f6c2cbe5a6953357dfc30b7c57e.tar.xz
linux-dev-c088a4985e5f6f6c2cbe5a6953357dfc30b7c57e.zip
regulator: core: don't disable regulator if is_enabled return error.
In regulator_late_cleanup when is_enabled failed, don't try to disable the regulator since it would likely to fail too and causing confusing error messages. Signed-off-by: Pi-Hsun Shih <pihsun@chromium.org> Link: https://lore.kernel.org/r/20201106064817.3290927-1-pihsun@chromium.org Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/core.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index a5ad553da8cd..70168f2a53ed 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -5843,13 +5843,14 @@ static int regulator_late_cleanup(struct device *dev, void *data)
if (rdev->use_count)
goto unlock;
- /* If we can't read the status assume it's on. */
+ /* If we can't read the status assume it's always on. */
if (ops->is_enabled)
enabled = ops->is_enabled(rdev);
else
enabled = 1;
- if (!enabled)
+ /* But if reading the status failed, assume that it's off. */
+ if (enabled <= 0)
goto unlock;
if (have_full_constraints()) {