From: sashiko-bot@kernel.org
To: "Bartosz Golaszewski" <bartosz.golaszewski@oss.qualcomm.com>
Cc: dri-devel@lists.freedesktop.org, linux-pci@vger.kernel.org
Subject: Re: [PATCH RFC] power: sequencing: rename pwrseq_power_on/off() to pwrseq_vote_on/off()
Date: Mon, 27 Jul 2026 10:10:06 +0000 [thread overview]
Message-ID: <20260727101007.627C21F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260727-pwrseq-vote-rename-v1-1-a2029aeeac65@oss.qualcomm.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Unhandled error from `pwrseq_vote_on()` in `slot_pwrctrl_power_on()` masks power-on failures.
- [High] Logic error in `pwrseq_vote_on()` executes `post_enable` and masks errors when `pwrseq_unit_enable()` fails.
--
--- Patch [1]: [PATCH RFC] power: sequencing: rename pwrseq_power_on/off() to pwrseq_vote_on/off() ---
commit e51e94e0f35e884f6a8dab94fc8221cd0e96b231
Author: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
power: sequencing: rename pwrseq_power_on/off() to pwrseq_vote_on/off()
This commit renames the power sequencing API functions pwrseq_power_on and
pwrseq_power_off to pwrseq_vote_on and pwrseq_vote_off respectively.
Link: https://lore.kernel.org/all/CAMRc=Mefxn81d0VUwmQgwFtffkL1=Er_1VQZCbC1Sa-Qph4t1w@mail.gmail.com/
> diff --git a/drivers/pci/pwrctrl/generic.c b/drivers/pci/pwrctrl/generic.c
> index a7e599d841e62..8872f6501352d 100644
> --- a/drivers/pci/pwrctrl/generic.c
> +++ b/drivers/pci/pwrctrl/generic.c
> @@ -29,7 +29,7 @@ static int slot_pwrctrl_power_on(struct pci_pwrctrl *pwrctrl)
> int ret;
>
> if (slot->pwrseq) {
> - pwrseq_power_on(slot->pwrseq);
> + pwrseq_vote_on(slot->pwrseq);
[Severity: High]
This isn't a bug introduced by this patch, but does this code ignore the
return value of pwrseq_vote_on()?
If the power sequence fails, the error is discarded and
slot_pwrctrl_power_on incorrectly returns 0. Could this lead to the PCI
subsystem attempting to probe unpowered hardware, causing fatal kernel
crashes when reading unpowered MMIO registers?
> return 0;
> }
>
[ ... ]
> diff --git a/drivers/power/sequencing/core.c b/drivers/power/sequencing/core.c
> index 02f42da915985..c630b14f6f2c4 100644
> --- a/drivers/power/sequencing/core.c
> +++ b/drivers/power/sequencing/core.c
[ ... ]
> @@ -887,7 +887,7 @@ static int pwrseq_unit_disable(struct pwrseq_device *pwrseq,
> * Returns:
> * 0 on success, negative error number on failure.
> */
> -int pwrseq_power_on(struct pwrseq_desc *desc)
> +int pwrseq_vote_on(struct pwrseq_desc *desc)
> {
> struct pwrseq_device *pwrseq;
> struct pwrseq_target *target;
[Severity: High]
This is a pre-existing issue, but looking at the body of pwrseq_vote_on(),
is there a missing check for the return value of pwrseq_unit_enable()
before calling target->post_enable()?
scoped_guard(mutex, &pwrseq->state_lock) {
ret = pwrseq_unit_enable(pwrseq, unit);
if (!ret)
desc->powered_on = true;
}
if (target->post_enable) {
ret = target->post_enable(pwrseq);
...
If pwrseq_unit_enable() fails, we bypass any failure check and proceed to
call target->post_enable(). If post_enable() succeeds, it overwrites the
original error with 0, meaning we return success even though the hardware
is unpowered.
If post_enable() fails, its error rollback unconditionally executes
pwrseq_unit_disable(), which triggers a WARN for unmatched power-off and
a potential negative enable count.
Should there be a check on ret before executing the post_enable logic?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260727-pwrseq-vote-rename-v1-1-a2029aeeac65@oss.qualcomm.com?part=1
next prev parent reply other threads:[~2026-07-27 10:10 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-07-27 9:57 [PATCH RFC] power: sequencing: rename pwrseq_power_on/off() to pwrseq_vote_on/off() Bartosz Golaszewski
2026-07-27 10:10 ` sashiko-bot [this message]
2026-07-27 16:14 ` Bjorn Helgaas
2026-07-27 16:26 ` Chen-Yu Tsai
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=20260727101007.627C21F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=bartosz.golaszewski@oss.qualcomm.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=linux-pci@vger.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