All of lore.kernel.org
 help / color / mirror / Atom feed
From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Shuangpeng Bai <shuangpeng.kernel@gmail.com>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] usb: typec: class: drop PD lookup reference
Date: Fri, 3 Jul 2026 16:27:20 +0300	[thread overview]
Message-ID: <ake4uMQUreEND_4A@kuha> (raw)
In-Reply-To: <20260702191329.2648043-1-shuangpeng.kernel@gmail.com>

On Thu, Jul 02, 2026 at 03:13:29PM -0400, Shuangpeng Bai wrote:
> usb_power_delivery_find() wraps class_find_device_by_name(). That helper
> returns a device reference that must be released by the caller.
> 
> select_usb_power_delivery_store() only needs this reference while calling
> the pd_set callback. Drop it once the callback returns. Otherwise the sysfs
> write can pin the selected USB Power Delivery object and prevent it from
> being released on unregister.
> 
> Fixes: a7cff92f0635 ("usb: typec: USB Power Delivery helpers for ports and partners")
> Signed-off-by: Shuangpeng Bai <shuangpeng.kernel@gmail.com>

You need to Cc stable@vger.kernel.org

https://docs.kernel.org/process/5.Posting.html#sending-the-patch

thanks,

> ---
>  drivers/usb/typec/class.c | 1 +
>  1 file changed, 1 insertion(+)
> 
> diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
> index 0977581ad1b6..0595e8cb83aa 100644
> --- a/drivers/usb/typec/class.c
> +++ b/drivers/usb/typec/class.c
> @@ -1619,6 +1619,7 @@ static ssize_t select_usb_power_delivery_store(struct device *dev,
>  		return -EINVAL;
>  
>  	ret = port->ops->pd_set(port, pd);
> +	put_device(&pd->dev);
>  	if (ret)
>  		return ret;
>  
> -- 
> 2.43.0

-- 
heikki

      reply	other threads:[~2026-07-03 13:27 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-02 19:13 [PATCH] usb: typec: class: drop PD lookup reference Shuangpeng Bai
2026-07-03 13:27 ` 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=ake4uMQUreEND_4A@kuha \
    --to=heikki.krogerus@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shuangpeng.kernel@gmail.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.