From: sashiko-bot@kernel.org
To: "Joshua Yeong" <joshua.yeong@starfivetech.com>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org
Subject: Re: [PATCH v4 2/3] regulator: Add RPMI voltage service
Date: Wed, 07 Oct 2026 10:14:28 +0000 [thread overview]
Message-ID: <sashiko-outbox-162848@kernel.org> (raw)
In-Reply-To: <20261007100022.2512187-3-joshua.yeong@starfivetech.com>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] regulator: mpxy_reg_set_voltage_sel() rejects 0 uV and masks list_voltage() error codes
--
commit cbc4d4861f2f3917f562d79d42a2f9d2a4373b1c
Author: Joshua Yeong <joshua.yeong@starfivetech.com>
regulator: Add RPMI voltage service
This commit adds a mailbox client based regulator driver for the RISC-V
RPMI voltage service group. It enumerates voltage domains advertised by
the platform microcontroller and registers them as regulators.
> diff --git a/drivers/regulator/riscv-rpmi-regulator.c b/drivers/regulator/riscv-rpmi-regulator.c
> new file mode 100644
> index 0000000000000..46119297e7de9
> --- /dev/null
> +++ b/drivers/regulator/riscv-rpmi-regulator.c
[ ... ]
> +static int mpxy_reg_set_voltage_sel(struct regulator_dev *rdev, unsigned int selector)
> +{
> + struct rpmi_reg_domain *mpxy_reg = rdev_get_drvdata(rdev);
> + struct rpmi_set_level_tx tx;
> + struct rpmi_set_level_rx rx = { };
> + struct rpmi_mbox_message msg;
> + s32 volt_uV;
> + int ret;
> +
> + volt_uV = mpxy_reg->desc.ops->list_voltage(rdev, selector);
> + if (volt_uV <= 0)
> + return -EINVAL;
[Severity: Medium]
Does this check incorrectly drop specific error codes from the regulator
core and prevent setting a 0 uV target?
If list_voltage() returns a specific error code (such as -ENOTSUPP), it
is masked by -EINVAL here, which degrades error reporting upstream.
Additionally, if the hardware explicitly supports and advertises a 0 uV
level (which is valid for regulators that support turning off the
output via voltage selection), the driver will falsely reject it.
The standard regulator subsystem pattern is to check:
if (volt_uV < 0)
return volt_uV;
> +
> + tx.domain_id = cpu_to_le32(mpxy_reg->id);
> + tx.level = cpu_to_le32(volt_uV);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261007100022.2512187-1-joshua.yeong@starfivetech.com?part=2
next prev parent reply other threads:[~2026-10-07 10:14 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-07 10:00 [PATCH v4 0/3] Add RISC-V RPMI voltage service support Joshua Yeong
2026-10-07 10:00 ` Joshua Yeong
2026-10-07 10:00 ` [PATCH v4 1/3] dt-bindings: regulator: Add RPMI voltage service bindings Joshua Yeong
2026-10-07 10:00 ` Joshua Yeong
2026-10-07 14:47 ` Conor Dooley
2026-10-07 14:47 ` Conor Dooley
2026-10-07 10:00 ` [PATCH v4 2/3] regulator: Add RPMI voltage service Joshua Yeong
2026-10-07 10:00 ` Joshua Yeong
2026-10-07 10:14 ` sashiko-bot [this message]
2026-10-07 10:00 ` [PATCH v4 3/3] MAINTAINERS: Add RISC-V RPMI voltage driver Joshua Yeong
2026-10-07 10:00 ` Joshua Yeong
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=sashiko-outbox-162848@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=joshua.yeong@starfivetech.com \
--cc=robh@kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.