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 <gerard.marull@nordicsemi.no>
This commit is contained in:
Gerard Marull-Paretas 2022-12-19 14:20:51 +01:00 committed by Fabio Baltieri
commit 63c005d3b4

View file

@ -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;
}