summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKory Maincent (Dent Project) <kory.maincent@bootlin.com>2024-11-21 15:42:28 +0100
committerMark Brown <broonie@kernel.org>2024-11-21 14:48:25 +0000
commit351f2bfe6362c663f45f5c6111f14365cfd094ab (patch)
tree7415dce6b422745fd3ef78a26234f283813c0d72
parent5262bcbb41d526f944a91a6a6c88dfb6fba3889b (diff)
downloadlwn-351f2bfe6362c663f45f5c6111f14365cfd094ab.tar.gz
lwn-351f2bfe6362c663f45f5c6111f14365cfd094ab.zip
regulator: core: Ignore unset max_uA constraints in current limit check
We should only consider max_uA constraints if they are explicitly defined. In cases where it is not set, we should assume the regulator has no current limit. Signed-off-by: Kory Maincent <kory.maincent@bootlin.com> Link: https://patch.msgid.link/20241121-feature_poe_port_prio-v3-2-83299fa6967c@bootlin.com Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--drivers/regulator/core.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 84d48e310aa8..8cb948a91e60 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -497,7 +497,8 @@ static int regulator_check_current_limit(struct regulator_dev *rdev,
return -EPERM;
}
- if (*max_uA > rdev->constraints->max_uA)
+ if (*max_uA > rdev->constraints->max_uA &&
+ rdev->constraints->max_uA)
*max_uA = rdev->constraints->max_uA;
if (*min_uA < rdev->constraints->min_uA)
*min_uA = rdev->constraints->min_uA;