diff options
author | Axel Lin <axel.lin@ingics.com> | 2021-05-21 10:30:20 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2021-05-21 22:05:48 +0300 |
commit | 36cb555fae0875d5416e8514a84a427bec6e4cda (patch) | |
tree | c55ff4b3cd3e839f21f0d0dab5a217ea53e196a6 /drivers/regulator/scmi-regulator.c | |
parent | 98e48cd9283dbac0e1445ee780889f10b3d1db6a (diff) | |
download | linux-36cb555fae0875d5416e8514a84a427bec6e4cda.tar.xz |
regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
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@ingics.com>
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20210521073020.1944981-1-axel.lin@ingics.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'drivers/regulator/scmi-regulator.c')
-rw-r--r-- | drivers/regulator/scmi-regulator.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c index a917c81e99fa..51eb97815c00 100644 --- a/drivers/regulator/scmi-regulator.c +++ b/drivers/regulator/scmi-regulator.c @@ -176,7 +176,7 @@ scmi_config_linear_regulator_mappings(struct scmi_regulator *sreg, 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; } |