From: Pi-Hsun Shih Date: Fri, 6 Nov 2020 06:48:17 +0000 (+0800) Subject: regulator: core: don't disable regulator if is_enabled return error. X-Git-Tag: v5.10-rc5~31^2~5 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=c088a4985e5f6f6c2cbe5a6953357dfc30b7c57e;p=thirdparty%2Fkernel%2Flinux.git 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 Link: https://lore.kernel.org/r/20201106064817.3290927-1-pihsun@chromium.org Signed-off-by: Mark Brown --- diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index a5ad553da8cd4..70168f2a53ed7 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()) {