regulator: qcom_spmi: Fix calculating number of voltages
authorAxel Lin <axel.lin@ingics.com>
Thu, 18 Jun 2015 00:50:39 +0000 (08:50 +0800)
committerMark Brown <broonie@kernel.org>
Fri, 19 Jun 2015 15:28:17 +0000 (16:28 +0100)
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>
drivers/regulator/qcom_spmi-regulator.c

index 16a5c1885153b7d16273e084c045b4a7a0f40df1..850a30a95b5b82149ed183960f9b746c88f764b6 100644 (file)
@@ -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;