summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2013-01-09 15:34:57 +0400
committerMark Brown <broonie@opensource.wolfsonmicro.com>2013-01-10 16:55:49 +0400
commit81d0a6ae7befb24c06f4aa4856af7f8d1f612171 (patch)
tree324aadeae9a1b561e83a7d930ef5f617a52270b5 /drivers
parentadf6178ad5552a7f2f742a8c85343c50f080c412 (diff)
downloadlinux-81d0a6ae7befb24c06f4aa4856af7f8d1f612171.tar.xz
regulator: max8998: Ensure enough delay time for max8998_set_voltage_buck_time_sel
Use DIV_ROUND_UP to prevent truncation by integer division issue. This ensures we return enough delay time. Signed-off-by: Axel Lin <axel.lin@ingics.com> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: stable@vger.kernel.org
Diffstat (limited to 'drivers')
-rw-r--r--drivers/regulator/max8998.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/max8998.c b/drivers/regulator/max8998.c
index 06be8cc7aadf..1f0df4046b86 100644
--- a/drivers/regulator/max8998.c
+++ b/drivers/regulator/max8998.c
@@ -447,7 +447,7 @@ static int max8998_set_voltage_buck_time_sel(struct regulator_dev *rdev,
difference = (new_selector - old_selector) * desc->step / 1000;
if (difference > 0)
- return difference / ((val & 0x0f) + 1);
+ return DIV_ROUND_UP(difference, (val & 0x0f) + 1);
return 0;
}