projects
/
GitHub
/
LineageOS
/
G12
/
android_kernel_amlogic_linux-4.9.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
684ae39
)
regulator: core: Ensure simple linear voltage mappings falls within the specified...
author
Axel Lin
<axel.lin@gmail.com>
Mon, 14 May 2012 02:33:37 +0000
(10:33 +0800)
committer
Mark Brown
<broonie@opensource.wolfsonmicro.com>
Mon, 14 May 2012 08:11:34 +0000
(09:11 +0100)
Integer division may truncate the result.
Use DIV_ROUND_UP to ensure simple linear voltage mappings falls within the
specified range.
Signed-off-by: Axel Lin <axel.lin@gmail.com>
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
drivers/regulator/core.c
patch
|
blob
|
blame
|
history
diff --git
a/drivers/regulator/core.c
b/drivers/regulator/core.c
index 5751f5ed47c0f5a780d6157d2251fe3e60fe10fc..8918271f9e85b20eff09e84398bc74b54645819d 100644
(file)
--- a/
drivers/regulator/core.c
+++ b/
drivers/regulator/core.c
@@
-2047,7
+2047,7
@@
int regulator_map_voltage_linear(struct regulator_dev *rdev,
return -EINVAL;
}
- ret =
(min_uV - rdev->desc->min_uV) / rdev->desc->uV_step
;
+ ret =
DIV_ROUND_UP(min_uV - rdev->desc->min_uV, rdev->desc->uV_step)
;
if (ret < 0)
return ret;