aboutsummaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2012-11-30 13:19:33 +0800
committerMark Brown <broonie@opensource.wolfsonmicro.com>2012-12-03 00:12:08 +0900
commit1a679930e1750c342d7e5fac787dc47484daec2e (patch)
tree829b667865d5a1a0999864d0ef8d2ccf8887059f /drivers/regulator
parent9489e9dcae718d5fde988e4a684a0f55b5f94d17 (diff)
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 <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/wm831x-dcdc.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 782c228a19b..411cb12385a 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -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;