未验证 提交 36cb555f 编写于 作者: A Axel Lin 提交者: Mark Brown

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: 0fbeae70 ("regulator: add SCMI driver")
Signed-off-by: NAxel Lin <axel.lin@ingics.com>
Reviewed-by: NCristian Marussi <cristian.marussi@arm.com>
Link: https://lore.kernel.org/r/20210521073020.1944981-1-axel.lin@ingics.comSigned-off-by: NMark Brown <broonie@kernel.org>
上级 98e48cd9
......@@ -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;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册