Skip to content

Commit

Permalink
regulator: core: don't disable regulator if is_enabled return error.
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Pi-Hsun Shih authored and Mark Brown committed Nov 10, 2020
1 parent cf1ad55 commit c088a49
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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()) {
Expand Down

0 comments on commit c088a49

Please sign in to comment.