From: sashiko-bot@kernel.org
To: "Oleg Keri" <okerixx@gmail.com>
Cc: linux-phy@lists.infradead.org, neil.armstrong@linaro.org,
olteanv@gmail.com, vkoul@kernel.org
Subject: Re: [PATCH v3 2/2] phy: qcom: qmp-combo: check qmp_combo_com_init() in the typec callbacks
Date: Wed, 16 Sep 2026 13:50:26 +0000 [thread overview]
Message-ID: <20260916135026.AE6401F000FF@smtp.kernel.org> (raw)
In-Reply-To: <20260916133814.3977-3-okerixx@gmail.com>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] phy: qmp-combo: unclocked MMIO access on teardown or retry after init failure
- [Medium] phy: qmp-combo: double disable of clocks and regulators on retry
--
commit baac7a5df2e9b48e6beb5448e1fa906647b06cb5
Author: Oleg Keri <okerixx@gmail.com>
phy: qcom: qmp-combo: check qmp_combo_com_init() in the typec callbacks
This commit adds error checking to qmp_combo_com_init() in the Type-C and
USB4 callbacks to prevent proceeding when PHY initialization fails. By
returning early, it avoids accessing PHY registers with disabled clocks
in the immediate call path.
> diff --git a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> index dad7c5cfcf0a6..65c30f3232d1b 100644
> --- a/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
> +++ b/drivers/phy/qualcomm/phy-qcom-qmp-combo.c
[ ... ]
> @@ -5042,7 +5050,12 @@ static int qmp_combo_typec_switch_set(struct typec_switch_dev *sw,
> qmp_combo_usb_power_off(qmp->usb_phy);
> qmp_combo_com_exit(qmp, true);
>
> - qmp_combo_com_init(qmp, true);
> + ret = qmp_combo_com_init(qmp, true);
> + if (ret) {
> + qmp->orientation = TYPEC_ORIENTATION_NONE;
> + return ret;
> + }
> +
[Severity: High]
Does returning here introduce a regression by abandoning the hardware in an
unclocked state while leaving the logical initialization counters active?
If qmp_combo_com_init() fails, it unwinds and leaves clocks disabled.
However, because the logical initialization counters are still active, a
subsequent Type-C event (retry) will call qmp_combo_usb_power_off() before
re-enabling clocks:
qmp_combo_typec_switch_set() {
...
if (qmp->usb_init_count || qmp->usb4_init_count)
qmp_combo_usb_power_off(qmp->usb_phy);
...
}
This leads to qmp_combo_usb_power_off() performing an MMIO write without
clocks running:
qmp_combo_usb_power_off() {
...
/* PHY reset */
qphy_setbits(pcs, cfg->regs[QPHY_SW_RESET], SW_RESET);
...
}
Will this cause a synchronous external abort (kernel panic) during teardown
or on the next retry?
[Severity: Medium]
Additionally, if we return early on failure, will the subsequent retry cause
a regression by double disabling clocks and regulators?
On the next Type-C event, if both USB and DP were active, the event bypasses
the fast-path check and calls qmp_combo_com_exit(qmp, true) again.
Since force is true, this unconditionally calls clk_bulk_disable_unprepare()
and regulator_bulk_disable() in qmp_combo_com_exit() on resources that were
already disabled by the error path in qmp_combo_com_init(). Could this
underflow the enable counts and corrupt resource tracking?
> if (qmp->usb_init_count || qmp->usb4_init_count)
> qmp_combo_usb_power_on(qmp->usb_phy);
> if (qmp->dp_init_count)
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260916133814.3977-1-okerixx@gmail.com?part=2
--
linux-phy mailing list
linux-phy@lists.infradead.org
https://lists.infradead.org/mailman/listinfo/linux-phy
prev parent reply other threads:[~2026-09-16 13:50 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 13:38 [PATCH v3 0/2] phy: qcom: qmp-combo: keep the Type-C callbacks off unclocked registers Oleg Keri
2026-09-16 13:38 ` [PATCH v3 1/2] phy: qcom: qmp-combo: hold a runtime PM reference in the typec callbacks Oleg Keri
2026-09-16 13:38 ` [PATCH v3 2/2] phy: qcom: qmp-combo: check qmp_combo_com_init() " Oleg Keri
2026-09-16 13:50 ` sashiko-bot [this message]
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=20260916135026.AE6401F000FF@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=linux-phy@lists.infradead.org \
--cc=neil.armstrong@linaro.org \
--cc=okerixx@gmail.com \
--cc=olteanv@gmail.com \
--cc=sashiko-reviews@lists.linux.dev \
--cc=vkoul@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