linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Arnaud Ferraris <arnaud.ferraris@collabora.com>
Cc: Badhri Jagan Sridharan <badhri@google.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Grzeschik <m.grzeschik@pengutronix.de>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] tcpm: allow looking for role_sw device in the main node
Date: Tue, 23 Dec 2025 11:45:10 +0200	[thread overview]
Message-ID: <aUpkppyoAnoSTV15@kuha> (raw)
In-Reply-To: <20251127-fix-ppp-power-v1-1-52cdd74c0ee6@collabora.com>

Thu, Nov 27, 2025 at 03:04:15PM +0100, Arnaud Ferraris kirjoitti:
> When ports are defined in the tcpc main node, fwnode_usb_role_switch_get
> returns an error, meaning usb_role_switch_get (which would succeed)
> never gets a chance to run as port->role_sw isn't NULL, causing a
> regression on devices where this is the case.
> 
> Fix this by turning the NULL check into IS_ERR_OR_NULL, so
> usb_role_switch_get can actually run and the device get properly probed.
> 
> Fixes: 2d8713f807a4 ("tcpm: switch check for role_sw device with fw_node")
> Cc: stable@vger.kernel.org
> Signed-off-by: Arnaud Ferraris <arnaud.ferraris@collabora.com>

Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>

> ---
>  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 cc78770509dbc..37698204d48d2 100644
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -7877,7 +7877,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 (!port->role_sw)
> +	if (IS_ERR_OR_NULL(port->role_sw))
>  		port->role_sw = usb_role_switch_get(port->dev);
>  	if (IS_ERR(port->role_sw)) {
>  		err = PTR_ERR(port->role_sw);
> 
> ---
> base-commit: 765e56e41a5af2d456ddda6cbd617b9d3295ab4e
> change-id: 20251127-fix-ppp-power-6d47f3a746f8
> 
> Best regards,
> -- 
> Arnaud Ferraris <arnaud.ferraris@collabora.com>

-- 
heikki

      parent reply	other threads:[~2025-12-23  9:45 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-27 14:04 [PATCH] tcpm: allow looking for role_sw device in the main node Arnaud Ferraris
2025-12-15  9:55 ` Dragan Simic
2025-12-23  9:45 ` Heikki Krogerus [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=aUpkppyoAnoSTV15@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=arnaud.ferraris@collabora.com \
    --cc=badhri@google.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=m.grzeschik@pengutronix.de \
    --cc=stable@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;
as well as URLs for NNTP newsgroup(s).