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

Commit 1a679930 authored by Axel Lin's avatar Axel Lin Committed by Mark Brown
Browse files

regulator: wm831x-dcdc: Ensure selected voltage falls within requested range



Use DIV_ROUND_UP to ensure selected voltage won't less than min_uV due to
integer truncation.

Signed-off-by: default avatarAxel Lin <axel.lin@ingics.com>
Signed-off-by: default avatarMark Brown <broonie@opensource.wolfsonmicro.com>
parent 9489e9dc
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -223,7 +223,7 @@ static int wm831x_buckv_map_voltage(struct regulator_dev *rdev,
	if (min_uV < 600000)
		vsel = 0;
	else if (min_uV <= 1800000)
		vsel = ((min_uV - 600000) / 12500) + 8;
		vsel = DIV_ROUND_UP(min_uV - 600000, 12500) + 8;
	else
		return -EINVAL;