Skip to contentSkip to conversation

regulator: qcom_spmi: Fix calculating number of voltages

PATCH Applied Axel Lin 3 participants 3 messages Jun 18, 2015 – Jun 19, 2015

Subsystems (2)
lore
Share & tools
lore

Axel Lin

author
#0 lore raw

PATCH 1/1 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.

---
 drivers/regulator/qcom_spmi-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/regulator/qcom_spmi-regulator.c +1 -1
index 162b865..42a60b4 100644
@@ -1108,7 +1108,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;
Signature · 1 line
2.1.0
maintainer Applied
#2 lore raw
In reply to Axel Lin
Quoted 2 lines · Axel Lin

n /= range->step_uV + 1; is equivalent to n /= (range->step_uV + 1); which is wrong. Fix it.

Applied, thanks.