From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
To: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Cc: gregkh@linuxfoundation.org, rdbabiera@google.com,
linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH] usb: typec: altmodes/displayport: Drop the device reference in dp_altmode_probe()
Date: Thu, 11 Dec 2025 15:42:14 +0200 [thread overview]
Message-ID: <aTrKNrvXX1gZ49cS@kuha> (raw)
In-Reply-To: <20251206070445.190770-1-lihaoxiang@isrc.iscas.ac.cn>
Sat, Dec 06, 2025 at 03:04:45PM +0800, Haoxiang Li kirjoitti:
> In error paths, call typec_altmode_put_plug() to drop the device reference
> obtained by typec_altmode_get_plug().
>
> Fixes: 71ba4fe56656 ("usb: typec: altmodes/displayport: add SOP' support")
> Cc: stable@vger.kernel.org
> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> ---
> drivers/usb/typec/altmodes/displayport.c | 10 +++++++---
> 1 file changed, 7 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/usb/typec/altmodes/displayport.c b/drivers/usb/typec/altmodes/displayport.c
> index 1dcb77faf85d..5d02c97e256e 100644
> --- a/drivers/usb/typec/altmodes/displayport.c
> +++ b/drivers/usb/typec/altmodes/displayport.c
> @@ -764,12 +764,16 @@ int dp_altmode_probe(struct typec_altmode *alt)
> if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
> DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
> !(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) &
> - DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)))
> - return -ENODEV;
> + DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) {
> + typec_altmode_put_plug(plug);
> + return -ENODEV;
> + }
>
> dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
> - if (!dp)
> + if (!dp) {
> + typec_altmode_put_plug(plug);
> return -ENOMEM;
> + }
>
> INIT_WORK(&dp->work, dp_altmode_work);
> mutex_init(&dp->lock);
> --
> 2.25.1
--
heikki
prev parent reply other threads:[~2025-12-11 13:42 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-12-06 7:04 [PATCH] usb: typec: altmodes/displayport: Drop the device reference in dp_altmode_probe() Haoxiang Li
2025-12-11 13:42 ` 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=aTrKNrvXX1gZ49cS@kuha \
--to=heikki.krogerus@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=lihaoxiang@isrc.iscas.ac.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rdbabiera@google.com \
--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