mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: "Nícolas F. R. A. Prado" <nfraprado@collabora.com>
Cc: kernel@collabora.com,
	AngeloGioacchino Del Regno 
	<angelogioacchino.delregno@collabora.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Prashant Malani <pmalani@chromium.org>,
	linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH] usb: typec: retimer: Add missing id check in match callback
Date: Tue, 2 Aug 2022 10:18:46 +0300	[thread overview]
Message-ID: <YujP1oOHojuB9iXa@kuha.fi.intel.com> (raw)
In-Reply-To: <20220725203129.1973260-1-nfraprado@collabora.com>

On Mon, Jul 25, 2022 at 04:31:29PM -0400, Nícolas F. R. A. Prado wrote:
> The fwnode_connection_find_match() function handles two cases: named
> references and graph endpoints. In the second case, the match function
> passed in is called with the id to check for the match. However, the
> match function for the recently added type-c retimer class assumes the
> connection has already been matched (which is only true for the first
> case).
> 
> The result is that with that change, all type-c nodes with graph
> endpoints defer probe indefinitely, independently of having a retimer
> connection or not.
> 
> Add the missing check, like is done by the type-c mux and usb role
> switch code, to fix the issue.
> 
> Fixes: ddaf8d96f93b ("usb: typec: Add support for retimers")
> Signed-off-by: Nícolas F. R. A. Prado <nfraprado@collabora.com>

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

> ---
> 
>  drivers/usb/typec/retimer.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/typec/retimer.c b/drivers/usb/typec/retimer.c
> index 051eaa7d2899..2003731f1bee 100644
> --- a/drivers/usb/typec/retimer.c
> +++ b/drivers/usb/typec/retimer.c
> @@ -36,8 +36,13 @@ static int retimer_fwnode_match(struct device *dev, const void *fwnode)
>  
>  static void *typec_retimer_match(struct fwnode_handle *fwnode, const char *id, void *data)
>  {
> -	struct device *dev  = class_find_device(&retimer_class, NULL, fwnode,
> -						retimer_fwnode_match);
> +	struct device *dev;
> +
> +	if (id && !fwnode_property_present(fwnode, id))
> +		return NULL;
> +
> +	dev = class_find_device(&retimer_class, NULL, fwnode,
> +				retimer_fwnode_match);
>  
>  	return dev ? to_typec_retimer(dev) : ERR_PTR(-EPROBE_DEFER);
>  }

thanks,

-- 
heikki

      parent reply	other threads:[~2022-08-02  7:18 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-25 20:31 Nícolas F. R. A. Prado
2022-07-26 16:50 ` Prashant Malani
2022-08-02  7:18 ` 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=YujP1oOHojuB9iXa@kuha.fi.intel.com \
    --to=heikki.krogerus@linux.intel.com \
    --cc=angelogioacchino.delregno@collabora.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=kernel@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=nfraprado@collabora.com \
    --cc=pmalani@chromium.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

all inboxes | Powered by JetHome®