summaryrefslogtreecommitdiff
path: root/drivers/regulator
diff options
context:
space:
mode:
authorAxel Lin <axel.lin@ingics.com>2015-06-18 03:50:39 +0300
committerMark Brown <broonie@kernel.org>2015-06-19 18:28:17 +0300
commit419d06a1cf58d9b99b25b5f578418b80070043a3 (patch)
tree41f0419998d2d4d88905bf9cd04c166ca1d71beb /drivers/regulator
parent9b2dfee3954e0b38a6a1b5305edd375defa8ad97 (diff)
downloadlinux-419d06a1cf58d9b99b25b5f578418b80070043a3.tar.xz
regulator: qcom_spmi: Fix calculating number of voltages
n /= range->step_uV + 1; is equivalent to n /= (range->step_uV + 1); which is wrong. Fix it. Signed-off-by: Axel Lin <axel.lin@ingics.com> Acked-by: Stephen Boyd <sboyd@codeaurora.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator')
-rw-r--r--drivers/regulator/qcom_spmi-regulator.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 16a5c1885153..850a30a95b5b 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -1106,7 +1106,7 @@ static void spmi_calculate_num_voltages(struct spmi_voltage_set_points *points)
n = 0;
if (range->set_point_max_uV) {
n = range->set_point_max_uV - range->set_point_min_uV;
- n /= range->step_uV + 1;
+ n = (n / range->step_uV) + 1;
}
range->n_voltages = n;
points->n_voltages += n;