From be462176dfe7d265e37ccfabd87cfa0ff7bc941a Mon Sep 17 00:00:00 2001 From: Tirupathi Reddy Date: Thu, 26 Oct 2017 19:28:17 +0530 Subject: regulator: qpnp: fix voltage min/max constraints check Fix voltage range selection logic used for voltage min/max constraints check. CRs-Fixed: 2136747 Change-Id: I80ab9ca583fda625ae2d9bd9e0c176a4b8c343db Signed-off-by: Tirupathi Reddy --- drivers/regulator/qpnp-regulator.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/qpnp-regulator.c b/drivers/regulator/qpnp-regulator.c index 08e991fa7db3..4098cb91f8fb 100644 --- a/drivers/regulator/qpnp-regulator.c +++ b/drivers/regulator/qpnp-regulator.c @@ -1771,7 +1771,7 @@ static int qpnp_regulator_check_constraints(struct qpnp_regulator *vreg, if (vreg->logical_type == QPNP_REGULATOR_LOGICAL_TYPE_FTSMPS) { max_uV = pdata->init_data.constraints.max_uV; /* Find the range which max_uV is inside of. */ - for (i = vreg->set_points->count - 1; i > 0; i--) { + for (i = vreg->set_points->count - 1; i >= 0; i--) { range = &vreg->set_points->range[i]; if (range->set_point_max_uV > 0 && max_uV >= range->set_point_min_uV -- cgit v1.2.3