From: Xu Yang <xu.yang_2@nxp.com>
To: badhri@google.com, heikki.krogerus@linux.intel.com,
gregkh@linuxfoundation.org, arnaud.ferraris@collabora.com,
dsimic@manjaro.org
Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
imx@lists.linux.dev, jun.li@nxp.com
Subject: [PATCH v2 1/2] Revert "tcpm: allow looking for role_sw device in the main node"
Date: Mon, 9 Mar 2026 15:43:12 +0800 [thread overview]
Message-ID: <20260309074313.2809867-2-xu.yang_2@nxp.com> (raw)
In-Reply-To: <20260309074313.2809867-1-xu.yang_2@nxp.com>
This reverts commit 1366cd228b0c67b60a2c0c26ef37fe9f7cfedb7f.
The fwnode_usb_role_switch_get() returns NULL only if no connection is
found, returns ERR_PTR(-EPROBE_DEFER) if connection is found but deferred
probe is needed, or a valid pointer of usb_role_switch.
When switching from a NULL check to IS_ERR_OR_NULL(), usb_role_switch_get()
returns NULL and overwrites the ERR_PTR(-EPROBE_DEFER) returned by
fwnode_usb_role_switch_get(). This causes the deferred probe indication to
be lost, preventing the USB role switch from ever being retrieved.
Fixes: 1366cd228b0c ("tcpm: allow looking for role_sw device in the main node")
Cc: stable@vger.kernel.org
Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
Changes in v2:
- no changes
---
drivers/usb/typec/tcpm/tcpm.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/usb/typec/tcpm/tcpm.c b/drivers/usb/typec/tcpm/tcpm.c
index 1d2f3af034c5..8e0e14a2704e 100644
--- a/drivers/usb/typec/tcpm/tcpm.c
+++ b/drivers/usb/typec/tcpm/tcpm.c
@@ -7890,7 +7890,7 @@ struct tcpm_port *tcpm_register_port(struct device *dev, struct tcpc_dev *tcpc)
port->partner_desc.identity = &port->partner_ident;
port->role_sw = fwnode_usb_role_switch_get(tcpc->fwnode);
- if (IS_ERR_OR_NULL(port->role_sw))
+ if (!port->role_sw)
port->role_sw = usb_role_switch_get(port->dev);
if (IS_ERR(port->role_sw)) {
err = PTR_ERR(port->role_sw);
--
2.34.1
next prev parent reply other threads:[~2026-03-09 7:41 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-09 7:43 [PATCH v2 0/2] improve usb_role_switch_is_parent() Xu Yang
2026-03-09 7:43 ` Xu Yang [this message]
2026-03-09 9:12 ` [PATCH v2 1/2] Revert "tcpm: allow looking for role_sw device in the main node" Arnaud Ferraris
2026-03-09 7:43 ` [PATCH v2 2/2] usb: roles: get usb role switch from parent only for usb-b-connector Xu Yang
2026-03-09 9:12 ` Arnaud Ferraris
2026-03-09 19:48 ` Frank Li
2026-03-10 2:47 ` Xu Yang
2026-03-09 11:32 ` [PATCH v2 0/2] improve usb_role_switch_is_parent() Heikki Krogerus
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=20260309074313.2809867-2-xu.yang_2@nxp.com \
--to=xu.yang_2@nxp.com \
--cc=arnaud.ferraris@collabora.com \
--cc=badhri@google.com \
--cc=dsimic@manjaro.org \
--cc=gregkh@linuxfoundation.org \
--cc=heikki.krogerus@linux.intel.com \
--cc=imx@lists.linux.dev \
--cc=jun.li@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.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