diff options
author | Sascha Hauer <s.hauer@pengutronix.de> | 2022-08-11 13:43:03 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2022-08-11 13:43:03 +0200 |
commit | ad4fa274907bbc78ebabb015b4351d5f9226f081 (patch) | |
tree | 3eb033a3d6bedb50459ea0181e5180e1531d00e8 /drivers/regulator/core.c | |
parent | 3fcf4400a7b051bdbe9fc175b88336519099ff22 (diff) | |
parent | 3a0f44a7839d475c58720c4091d5e008215cd166 (diff) | |
download | barebox-ad4fa274907bbc78ebabb015b4351d5f9226f081.tar.gz barebox-ad4fa274907bbc78ebabb015b4351d5f9226f081.tar.xz |
Merge branch 'for-next/misc'
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 29a335f502..472b26f3a0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -66,6 +66,7 @@ static int regulator_enable_internal(struct regulator_internal *ri) static int regulator_disable_internal(struct regulator_internal *ri) { + struct regulator_dev *rdev = ri->rdev; int ret; if (!ri->enable_count) @@ -76,10 +77,14 @@ static int regulator_disable_internal(struct regulator_internal *ri) return 0; } - if (!ri->rdev->desc->ops->disable) + /* Crisis averted, be loud about the unbalanced regulator use */ + if (WARN_ON(rdev->always_on)) + return -EPERM; + + if (!rdev->desc->ops->disable) return -ENOSYS; - ret = ri->rdev->desc->ops->disable(ri->rdev); + ret = rdev->desc->ops->disable(rdev); if (ret) return ret; |