regulator: wm831x-dcdc: Ensure selected voltage falls within requested range
PATCH 1/1 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]>
--- drivers/regulator/wm831x-dcdc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/wm831x-dcdc.c +1 -1
@@ -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 ;
Signature · 1 line
1.7.9.5
Mark Brown
AppliedQuoted 2 lines · Axel Lin
Use
DIV_ROUND_UPto ensure selected voltage won't less thanmin_uVdue to integer truncation.
Applied, thanks.