From: sashiko-bot@kernel.org
To: "Linus Walleij" <linusw@kernel.org>
Cc: conor+dt@kernel.org, devicetree@vger.kernel.org, robh@kernel.org,
lee@kernel.org, mfd@lists.linux.dev
Subject: Re: [PATCH v2 06/13] regulator: ab8500: Propagate mode enable read errors
Date: Tue, 01 Sep 2026 20:26:54 +0000 [thread overview]
Message-ID: <20260901202654.A17901F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260901-ux500-dts-snowball-regulator-v2-6-fe88b01829bf@kernel.org>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
Pre-existing issues:
- [High] Uninitialized stack variable used and hardware error ignored in `ab8500_regulator_get_mode`.
--
commit e3e13ae0ac9e7a8bd4d65f25709df32c5a1808c8
Author: Linus Walleij <linusw@kernel.org>
regulator: ab8500: Propagate mode enable read errors
For regulators whose enable and mode share a state field, set_mode()
first reads that field so changing the requested mode does not enable a
disabled rail. A register read error is currently treated as true and
the driver proceeds to write the new mode, potentially enabling a rail
whose state is unknown. This patch returns the read error instead of
changing the register or cached mode.
> diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
> index 05c6b9c7af0c7..e4c3502c8dbcc 100644
> --- a/drivers/regulator/ab8500.c
> +++ b/drivers/regulator/ab8500.c
[ ... ]
> @@ -490,7 +490,17 @@ static int ab8500_regulator_set_mode(struct regulator_dev *rdev,
> goto out_unlock;
> }
>
> - if (info->mode_mask || ab8500_regulator_is_enabled(rdev)) {
> + if (info->mode_mask) {
> + enabled = 1;
> + } else {
> + enabled = ab8500_regulator_is_enabled(rdev);
> + if (enabled < 0) {
> + ret = enabled;
> + goto out_unlock;
> + }
> + }
> +
> + if (enabled) {
> ret = abx500_mask_and_set_register_interruptible(info->dev,
> bank, reg, mask, val);
> if (ret < 0) {
[Severity: High]
This isn't a bug introduced by this patch, but is there a similar logic issue
in ab8500_regulator_get_mode() just below this?
If a hardware or bus error occurs when reading the mode register:
drivers/regulator/ab8500.c:ab8500_regulator_get_mode() {
...
if (info->mode_mask) {
ret = abx500_get_register_interruptible(info->dev,
info->mode_bank, info->mode_reg, &val);
val = val & info->mode_mask;
...
}
Does this code ignore the hardware error code in ret and proceed to read the
uninitialized stack variable val? By not checking if the read succeeded, it
appears to return either a random regulator mode or -EINVAL to the caller,
which could mask the real error and feed incorrect states to the regulator
core.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260901-ux500-dts-snowball-regulator-v2-0-fe88b01829bf@kernel.org?part=6
next prev parent reply other threads:[~2026-09-01 20:26 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-01 20:02 [PATCH v2 00/13] Add AB8500 buck regulators to the Ux500 device tree Linus Walleij
2026-09-01 20:02 ` [PATCH v2 01/13] regulator: ab8500: Fix AB8505 VANA voltage selectors Linus Walleij
2026-09-01 20:09 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 02/13] regulator: ab8500: Add AB8505 VAUX3 3.05 V setting Linus Walleij
2026-09-01 20:08 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 03/13] regulator: ab8500: Handle AB8505 VINTCORE selector 7 Linus Walleij
2026-09-01 20:15 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 04/13] regulator: ab8500: Treat cut 1.0 VAUX3 as fixed Linus Walleij
2026-09-01 20:17 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 05/13] regulator: ab8500: Test dedicated enable bits only Linus Walleij
2026-09-01 20:21 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 06/13] regulator: ab8500: Propagate mode enable read errors Linus Walleij
2026-09-01 20:26 ` sashiko-bot [this message]
2026-09-01 20:02 ` [PATCH v2 07/13] regulator: ab8500: Use linear ranges for LDO voltages Linus Walleij
2026-09-01 20:27 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 08/13] dt-bindings: mfd: ab8500: Add regulators Linus Walleij
2026-09-01 20:30 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 09/13] regulator: ab8500: Add buck converter support Linus Walleij
2026-09-01 20:31 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 10/13] regulator: ab8500: Preserve OTP-enabled buck regulators Linus Walleij
2026-09-01 20:38 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 11/13] regulator: ab8500: Use scoped guard for shared mode mutex Linus Walleij
2026-09-01 20:37 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 12/13] ARM: dts: ux500: Add new AB8500/AB8505 regulators Linus Walleij
2026-09-01 20:41 ` sashiko-bot
2026-09-01 20:02 ` [PATCH v2 13/13] ARM: dts: ux500: Fix up regulator assignments Linus Walleij
2026-09-01 20:45 ` sashiko-bot
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=20260901202654.A17901F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=lee@kernel.org \
--cc=linusw@kernel.org \
--cc=mfd@lists.linux.dev \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox