]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
regulator: core: Ignore unset max_uA constraints in current limit check
authorKory Maincent (Dent Project) <kory.maincent@bootlin.com>
Thu, 21 Nov 2024 14:42:28 +0000 (15:42 +0100)
committerMark Brown <broonie@kernel.org>
Thu, 21 Nov 2024 14:48:25 +0000 (14:48 +0000)
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>
drivers/regulator/core.c

index 84d48e310aa8679564b577930d571b073bf3fa4e..8cb948a91e60d958c6b5ec97d736e6e3bf4b47eb 100644 (file)
@@ -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;