diff --git a/drivers/regulator/regulator_common.c b/drivers/regulator/regulator_common.c index 84ab8c6161d..f2b2e7097fd 100644 --- a/drivers/regulator/regulator_common.c +++ b/drivers/regulator/regulator_common.c @@ -137,7 +137,7 @@ bool regulator_is_supported_voltage(const struct device *dev, int32_t min_uv, unsigned int volt_cnt; /* voltage may not be allowed, even if supported */ - if ((min_uv < config->min_uv) || (max_uv > config->max_uv)) { + if ((min_uv > config->max_uv) || (max_uv < config->min_uv)) { return false; } @@ -169,7 +169,7 @@ int regulator_set_voltage(const struct device *dev, int32_t min_uv, } /* voltage may not be allowed, even if supported */ - if ((min_uv < config->min_uv) || (max_uv > config->max_uv)) { + if ((min_uv > config->max_uv) || (max_uv < config->min_uv)) { return -EINVAL; }