Linux USB
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Haoxiang Li <haoxiang_li2024@163.com>
Cc: gregkh@linuxfoundation.org, bleung@chromium.org,
	abelvesa@kernel.org, jthies@google.com,
	myrrhperiwinkle@qtmlabs.xyz, pooja.katiyar@intel.com,
	venkat.jayaraman@intel.com, yuanhsinte@chromium.org,
	johan@kernel.org, quic_linyyuan@quicinc.com,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
	stable@vger.kernel.org
Subject: Re: [PATCH] usb: typec: ucsi: destroy work queue on fwnode_usb_role_switch_get() fails
Date: Wed, 24 Jun 2026 13:56:42 +0300	[thread overview]
Message-ID: <aju36u5fQVLIgMDh@kuha> (raw)
In-Reply-To: <20260624081301.2866854-1-haoxiang_li2024@163.com>

On Wed, Jun 24, 2026 at 04:13:01PM +0800, Haoxiang Li wrote:
> Call destroy_workqueue() if fwnode_usb_role_switch_get() fails
> to destroy the work queue con->wq.
> 
> Fixes: 3c162511530c ("usb: typec: ucsi: Wait for the USB role switches")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com>
> ---
>  drivers/usb/typec/ucsi/ucsi.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
> index 61cb24ed820f..63303e26929f 100644
> --- a/drivers/usb/typec/ucsi/ucsi.c
> +++ b/drivers/usb/typec/ucsi/ucsi.c
> @@ -1663,9 +1663,11 @@ static int ucsi_register_port(struct ucsi *ucsi, struct ucsi_connector *con)
>  
>  	cap->fwnode = ucsi_find_fwnode(con);
>  	con->usb_role_sw = fwnode_usb_role_switch_get(cap->fwnode);
> -	if (IS_ERR(con->usb_role_sw))
> +	if (IS_ERR(con->usb_role_sw)) {
> +		destroy_workqueue(con->wq);
>  		return dev_err_probe(ucsi->dev, PTR_ERR(con->usb_role_sw),
>  			"con%d: failed to get usb role switch\n", con->num);
> +	}

You need to add a label err_destroy_workqueue after the
mutex_unlock(&con->lock) and then here:

	if (IS_ERR(con->usb_role_sw)) {
		ret = PTR_ERR(con->usb_role_sw);
		dev_err(ucsi->dev, "con%d: failed to get usb role switch\n", con->num);
                goto err_destroy_workqueue;
	}

thanks,

-- 
heikki

      reply	other threads:[~2026-06-24 10:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-24  8:13 [PATCH] usb: typec: ucsi: destroy work queue on fwnode_usb_role_switch_get() fails Haoxiang Li
2026-06-24 10:56 ` 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=aju36u5fQVLIgMDh@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=abelvesa@kernel.org \
    --cc=bleung@chromium.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=haoxiang_li2024@163.com \
    --cc=johan@kernel.org \
    --cc=jthies@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=myrrhperiwinkle@qtmlabs.xyz \
    --cc=pooja.katiyar@intel.com \
    --cc=quic_linyyuan@quicinc.com \
    --cc=stable@vger.kernel.org \
    --cc=venkat.jayaraman@intel.com \
    --cc=yuanhsinte@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