Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0bdc81e4 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

regulator: core: Properly handle the case min_uV < rdev->desc->min_uV in map_voltage_linear



Properly handle the case if the specified min_uV is less than the voltage given
by the lowest selector.

Signed-off-by: default avatarAxel Lin <axel.lin@gmail.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 61663171
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -2050,6 +2050,9 @@ int regulator_map_voltage_linear(struct regulator_dev *rdev,
		return -EINVAL;
	}

	if (min_uV < rdev->desc->min_uV)
		min_uV = rdev->desc->min_uV;

	ret = DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step);
	if (ret < 0)
		return ret;