From: Axel Lin Date: Thu, 18 Jun 2015 00:50:39 +0000 (+0800) Subject: regulator: qcom_spmi: Fix calculating number of voltages X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=419d06a1cf58d9b99b25b5f578418b80070043a3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git 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 Acked-by: Stephen Boyd Signed-off-by: Mark Brown --- 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;