mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-11-04 01:35:25 -05:00
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: Axel Lin <[email protected]> Signed-off-by: Mark Brown <[email protected]>
This commit is contained in:
parent
9489e9dcae
commit
1a679930e1
1 changed files with 1 additions and 1 deletions
|
|
@ -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;
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue