From: sashiko-bot@kernel.org
To: "Michał Kopeć" <michal@nozomi.space>
Cc: devicetree@vger.kernel.org, robh@kernel.org, conor+dt@kernel.org
Subject: Re: [PATCH v2 2/4] pmdomain: mediatek: Restore a register after powering a domain on
Date: Sun, 11 Oct 2026 18:55:01 +0000 [thread overview]
Message-ID: <sashiko-outbox-167387@kernel.org> (raw)
In-Reply-To: <20261011184755.2058017-3-michal@nozomi.space>
Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [Medium] pmdomain: mediatek: Incomplete error path in scpsys_power_on() fails to unwind hardware state
--
commit f298ac6e69f935973c035a0a1e72ad788976e0f8
Author: Michał Kopeć <michal@nozomi.space>
pmdomain: mediatek: Restore a register after powering a domain on
Some blocks lose a setting when their power domain is turned off, and it
has to be restored every time the domain is powered on again, before
the devices in the domain use it.
> diff --git a/drivers/pmdomain/mediatek/mtk-pm-domains.c b/drivers/pmdomain/mediatek/mtk-pm-domains.c
> index f0fa79e01f9c3..0585a663f48a6 100644
> --- a/drivers/pmdomain/mediatek/mtk-pm-domains.c
> +++ b/drivers/pmdomain/mediatek/mtk-pm-domains.c
> @@ -755,6 +757,13 @@ static int scpsys_power_on(struct generic_pm_domain *genpd)
> if (ret < 0)
> goto err_disable_sram;
>
> + if (pd->init_regmap) {
> + ret = regmap_write(pd->init_regmap, pd->data->reg_init->ofs,
> + pd->data->reg_init->val);
> + if (ret)
> + goto err_enable_bus_protect;
[Severity: Medium]
If regmap_write fails here, the error path jumps to err_enable_bus_protect,
which cascades down to err_pwr_ack:
err_enable_bus_protect:
scpsys_bus_protect_enable(pd, 0);
err_disable_sram:
...
err_pwr_ack:
clk_bulk_disable_unprepare(pd->num_clks, pd->clks);
err_reg:
scpsys_regulator_disable(pd->supply);
return ret;
However, err_pwr_ack does not reverse several earlier steps from
scpsys_power_on(). It fails to call scpsys_bus_protect_enable(pd,
BUS_PROT_IGNORE_SUBCLK), does not re-enable ext_buck_iso, and does not invoke
scpsys_ctl_pwrseq_off() (or the other pwrseq variants).
Does this leave the power domain logically powered off in genpd, but physically
powered on and partially unprotected, risking system instability on subsequent
power cycles?
> + }
> +
> if (MTK_SCPD_CAPS(pd, MTK_SCPD_STRICT_BUS_PROTECTION)) {
> ret = clk_bulk_prepare_enable(pd->num_subsys_clks,
> pd->subsys_clks);
--
Sashiko AI review · https://sashiko.dev/#/patchset/20261011184755.2058017-1-michal@nozomi.space?part=2
next prev parent reply other threads:[~2026-10-11 18:55 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-11 18:47 [PATCH v2 0/4] pmdomain: mediatek: Enable the GPU timestamp counter on MT8188 Michał Kopeć
2026-10-11 18:47 ` [PATCH v2 1/4] dt-bindings: power: mediatek: Add the MT8188 access controllers Michał Kopeć
2026-10-11 18:47 ` [PATCH v2 2/4] pmdomain: mediatek: Restore a register after powering a domain on Michał Kopeć
2026-10-11 18:55 ` sashiko-bot [this message]
2026-10-11 18:47 ` [PATCH v2 3/4] pmdomain: mediatek: mt8188: Enable the GPU timestamp counter Michał Kopeć
2026-10-11 18:57 ` sashiko-bot
2026-10-11 18:47 ` [PATCH v2 4/4] arm64: dts: mediatek: mt8188: Use access-controllers in the power controller Michał Kopeć
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-167387@kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=michal@nozomi.space \
--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