Skip to content

Commit 128bb7f

Browse files
Haoxiang Ligregkh
authored andcommitted
usb: typec: altmodes/displayport: Drop the device reference in dp_altmode_probe()
In error paths, call typec_altmode_put_plug() to drop the device reference obtained by typec_altmode_get_plug(). Fixes: 71ba4fe ("usb: typec: altmodes/displayport: add SOP' support") Cc: stable <stable@kernel.org> Signed-off-by: Haoxiang Li <lihaoxiang@isrc.iscas.ac.cn> Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Link: https://patch.msgid.link/20251206070445.190770-1-lihaoxiang@isrc.iscas.ac.cn Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
1 parent 41ca62e commit 128bb7f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/usb/typec/altmodes/displayport.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -766,12 +766,16 @@ int dp_altmode_probe(struct typec_altmode *alt)
766766
if (!(DP_CAP_PIN_ASSIGN_DFP_D(port->vdo) &
767767
DP_CAP_PIN_ASSIGN_UFP_D(alt->vdo)) &&
768768
!(DP_CAP_PIN_ASSIGN_UFP_D(port->vdo) &
769-
DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo)))
769+
DP_CAP_PIN_ASSIGN_DFP_D(alt->vdo))) {
770+
typec_altmode_put_plug(plug);
770771
return -ENODEV;
772+
}
771773

772774
dp = devm_kzalloc(&alt->dev, sizeof(*dp), GFP_KERNEL);
773-
if (!dp)
775+
if (!dp) {
776+
typec_altmode_put_plug(plug);
774777
return -ENOMEM;
778+
}
775779

776780
INIT_WORK(&dp->work, dp_altmode_work);
777781
mutex_init(&dp->lock);

0 commit comments

Comments
 (0)