From: Cristian Marussi <cristian.marussi@arm.com>
To: Axel Lin <axel.lin@ingics.com>
Cc: Mark Brown <broonie@kernel.org>,
Liam Girdwood <lgirdwood@gmail.com>,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] regulator: scmi: Fix off-by-one for linear regulators .n_voltages setting
Date: Fri, 21 May 2021 19:26:02 +0100 [thread overview]
Message-ID: <20210521182602.GM28060@e120937-lin> (raw)
In-Reply-To: <20210521073020.1944981-1-axel.lin@ingics.com>
Hi,
On Fri, May 21, 2021 at 03:30:20PM +0800, Axel Lin wrote:
> 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>
> ---
Right. Good catch.
Reviewed-by: Cristian Marussi <cristian.marussi@arm.com>
Thanks,
Cristian
> drivers/regulator/scmi-regulator.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/regulator/scmi-regulator.c b/drivers/regulator/scmi-regulator.c
> index bbadf72b94e8..1f02f60ad136 100644
> --- a/drivers/regulator/scmi-regulator.c
> +++ b/drivers/regulator/scmi-regulator.c
> @@ -173,7 +173,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;
> }
>
> --
> 2.25.1
>
next prev parent reply other threads:[~2021-05-21 18:26 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-05-21 7:30 Axel Lin
2021-05-21 18:26 ` Cristian Marussi [this message]
2021-05-21 19:37 ` Mark Brown
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210521182602.GM28060@e120937-lin \
--to=cristian.marussi@arm.com \
--cc=axel.lin@ingics.com \
--cc=broonie@kernel.org \
--cc=lgirdwood@gmail.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®