From 63c005d3b4bf393560ad45901814dd9f3560ccac Mon Sep 17 00:00:00 2001 From: Gerard Marull-Paretas Date: Mon, 19 Dec 2022 14:20:51 +0100 Subject: [PATCH] drivers: regulator: fix set_current_limit limits check Only current ranges out of the allowed range have to be skipped. Signed-off-by: Gerard Marull-Paretas --- drivers/regulator/regulator_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/regulator_common.c b/drivers/regulator/regulator_common.c index f2b2e7097fd..40045d0d666 100644 --- a/drivers/regulator/regulator_common.c +++ b/drivers/regulator/regulator_common.c @@ -189,7 +189,7 @@ int regulator_set_current_limit(const struct device *dev, int32_t min_ua, } /* current limit may not be allowed, even if supported */ - if ((min_ua < config->min_ua) || (max_ua > config->max_ua)) { + if ((min_ua > config->max_ua) || (max_ua < config->min_ua)) { return -EINVAL; }