From: Jing Xiangfeng Date: Thu, 17 Jun 2021 07:32:26 +0000 (+0800) Subject: usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() X-Git-Tag: v4.19.198~411 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9c7de678190ac6d48e51633584075d045901b580;p=thirdparty%2Fkernel%2Fstable.git usb: typec: Add the missed altmode_id_remove() in typec_register_altmode() commit 03026197bb657d784220b040c6173267a0375741 upstream. typec_register_altmode() misses to call altmode_id_remove() in an error path. Add the missed function call to fix it. Fixes: 8a37d87d72f0 ("usb: typec: Bus type for alternate modes") Cc: stable Acked-by: Heikki Krogerus Signed-off-by: Jing Xiangfeng Link: https://lore.kernel.org/r/20210617073226.47599-1-jingxiangfeng@huawei.com Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c index 1916ee1600b47..8dae6ff2377ce 100644 --- a/drivers/usb/typec/class.c +++ b/drivers/usb/typec/class.c @@ -481,8 +481,10 @@ typec_register_altmode(struct device *parent, int ret; alt = kzalloc(sizeof(*alt), GFP_KERNEL); - if (!alt) + if (!alt) { + altmode_id_remove(parent, id); return ERR_PTR(-ENOMEM); + } alt->adev.svid = desc->svid; alt->adev.mode = desc->mode;