From: sashiko-bot@kernel.org
To: "Alexandre MINETTE" <contact@alex-min.fr>
Cc: conor+dt@kernel.org, robh@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v5 5/6] extcon: qcom-spmi-misc: match PM8xxx USB ID platform device
Date: Tue, 04 Aug 2026 07:01:28 +0000 [thread overview]
Message-ID: <20260804070129.5313C1F000E9@smtp.kernel.org> (raw)
In-Reply-To: <20260804-mainline-send-v1-sending-v5-5-149dd4372ac8@alex-min.fr>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
Pre-existing issues:
- [High] Unbalanced IRQ wake state and lost error codes in suspend/resume due to overwritten return value.
- [High] Failure to read ID IRQ line state aborts VBUS detection entirely.
--
--- Patch [5]: [PATCH v5 5/6] extcon: qcom-spmi-misc: match PM8xxx USB ID platform device ---
commit b4c56e1cb1867cf0c94f9ba05c18446ffacc8bd5
Author: Alexandre MINETTE <contact@alex-min.fr>
extcon: qcom-spmi-misc: match PM8xxx USB ID platform device
The PM8xxx MFD registers the PM8921 USB ID detector as a platform device
named "qcom-pm8xxx-usb-id". Its reused firmware node remains compatible
with "qcom,pm8921", so it does not match the extcon driver's OF table.
Add a platform device ID so the existing extcon driver binds to this
device and consumes its named USB ID interrupt.
> diff --git a/drivers/extcon/extcon-qcom-spmi-misc.c b/drivers/extcon/extcon-qcom-spmi-misc.c
> index afaba5685c3dc..e16c109b553e2 100644
> --- a/drivers/extcon/extcon-qcom-spmi-misc.c
> +++ b/drivers/extcon/extcon-qcom-spmi-misc.c
> @@ -204,8 +204,15 @@ static const struct of_device_id qcom_usb_extcon_dt_match[] = {
> };
> MODULE_DEVICE_TABLE(of, qcom_usb_extcon_dt_match);
>
> +static const struct platform_device_id qcom_usb_extcon_id[] = {
> + { "qcom-pm8xxx-usb-id" },
> + { }
> +};
> +MODULE_DEVICE_TABLE(platform, qcom_usb_extcon_id);
> +
> static struct platform_driver qcom_usb_extcon_driver = {
> .probe = qcom_usb_extcon_probe,
> + .id_table = qcom_usb_extcon_id,
> .driver = {
> .name = "extcon-pm8941-misc",
> .pm = &qcom_usb_extcon_pm_ops,
[Severity: High]
This is a pre-existing issue, but I noticed a potential problem in the
suspend/resume path that might cause unbalanced IRQ wake disables or leaked
wake_depth refcounts:
drivers/extcon/extcon-qcom-spmi-misc.c:qcom_usb_extcon_suspend() {
...
if (device_may_wakeup(dev)) {
if (info->id_irq > 0)
ret = enable_irq_wake(info->id_irq);
if (info->vbus_irq > 0)
ret = enable_irq_wake(info->vbus_irq);
}
return ret;
}
If enable_irq_wake(info->id_irq) fails, the error code is stored in ret.
However, if enable_irq_wake(info->vbus_irq) succeeds, it returns 0 and
overwrites the previous error code in ret.
If this happens, the system will suspend and eventually call
qcom_usb_extcon_resume(). In the resume path, disable_irq_wake(info->id_irq)
will be called on an IRQ that was never successfully enabled for wake, which
triggers a kernel WARN for an unbalanced IRQ wake disable.
Conversely, if id_irq succeeds but vbus_irq fails, ret returns an error to
the PM core. The suspend is aborted, meaning qcom_usb_extcon_resume() is
skipped for this device. This prevents disable_irq_wake(info->id_irq) from
being called, permanently leaking the IRQ's wake_depth refcount.
Should the return codes for these two wake IRQs be handled independently?
[Severity: High]
This isn't a bug introduced by this patch, but I also noticed a potential
logic issue in how cable detection is handled:
drivers/extcon/extcon-qcom-spmi-misc.c:qcom_usb_extcon_detect_cable() {
...
if (info->id_irq > 0) {
/* check ID and update cable state */
ret = irq_get_irqchip_state(info->id_irq,
IRQCHIP_STATE_LINE_LEVEL, &state);
if (ret)
return;
...
}
If reading the ID IRQ line state fails (for instance, due to an SPMI bus
transaction error), the function returns immediately.
Since the VBUS state detection happens after this in the same function,
returning early completely aborts the independent VBUS detection logic. This
means USB insertions and removals could be completely missed by the extcon
driver just because of a read failure on the ID pin line.
Would it be better to let the VBUS detection proceed even if the ID line
state read fails?
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260804-mainline-send-v1-sending-v5-0-149dd4372ac8@alex-min.fr?part=5
next prev parent reply other threads:[~2026-08-04 7:01 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-04 6:34 [PATCH v5 0/6] Add Samsung Galaxy S4 support Alexandre MINETTE via B4 Relay
2026-08-04 6:34 ` [PATCH v5 1/6] dt-bindings: arm: qcom: Add Samsung Galaxy S4 Alexandre MINETTE via B4 Relay
2026-08-04 6:34 ` [PATCH v5 2/6] pinctrl: qcom: Register functions before enabling pinctrl Alexandre MINETTE via B4 Relay
2026-08-04 6:34 ` [PATCH v5 3/6] ARM: dts: qcom: apq8064: Fix USB controller clocks Alexandre MINETTE via B4 Relay
2026-08-04 6:52 ` sashiko-bot
2026-08-04 14:24 ` Antony Kurniawan Soemardi
2026-08-04 6:34 ` [PATCH v5 4/6] mfd: qcom-pm8xxx: register PM8921 USB ID extcon Alexandre MINETTE via B4 Relay
2026-08-04 6:54 ` sashiko-bot
2026-08-04 6:34 ` [PATCH v5 5/6] extcon: qcom-spmi-misc: match PM8xxx USB ID platform device Alexandre MINETTE via B4 Relay
2026-08-04 7:01 ` sashiko-bot [this message]
2026-08-04 6:34 ` [PATCH v5 6/6] ARM: dts: qcom: Add Samsung Galaxy S4 Alexandre MINETTE via B4 Relay
2026-08-04 6:53 ` 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=20260804070129.5313C1F000E9@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=conor+dt@kernel.org \
--cc=contact@alex-min.fr \
--cc=devicetree@vger.kernel.org \
--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