[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20210614102702.122535731@linuxfoundation.org>
Date: Mon, 14 Jun 2021 12:27:31 +0200
From: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
To: linux-kernel@...r.kernel.org
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
stable@...r.kernel.org, Axel Lin <axel.lin@...ics.com>,
Cristian Marussi <cristian.marussi@....com>,
Mark Brown <broonie@...nel.org>
Subject: [PATCH 5.12 119/173] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
From: Axel Lin <axel.lin@...ics.com>
commit 36cb555fae0875d5416e8514a84a427bec6e4cda upstream.
For linear regulators, the .n_voltages is (max_uv - min_uv) / uv_step + 1.
Fixes: 0fbeae70ee7c ("regulator: add SCMI driver")
Signed-off-by: Axel Lin <axel.lin@...ics.com>
Reviewed-by: Cristian Marussi <cristian.marussi@....com>
Link: https://lore.kernel.org/r/20210521073020.1944981-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@...nel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
---
drivers/regulator/scmi-regulator.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/drivers/regulator/scmi-regulator.c
+++ b/drivers/regulator/scmi-regulator.c
@@ -176,7 +176,7 @@ scmi_config_linear_regulator_mappings(st
sreg->desc.uV_step =
vinfo->levels_uv[SCMI_VOLTAGE_SEGMENT_STEP];
sreg->desc.linear_min_sel = 0;
- sreg->desc.n_voltages = delta_uV / sreg->desc.uV_step;
+ sreg->desc.n_voltages = (delta_uV / sreg->desc.uV_step) + 1;
sreg->desc.ops = &scmi_reg_linear_ops;
}
Powered by blists - more mailing lists