Skip to content

Commit

Permalink
regulator: core: Ignore unset max_uA constraints in current limit check
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Kory Maincent (Dent Project) authored and Mark Brown committed Nov 21, 2024
1 parent 5262bcb commit 351f2bf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion drivers/regulator/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 351f2bf

Please sign in to comment.