aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJing Xiangfeng <[email protected]>2021-06-17 15:32:26 +0800
committerGreg Kroah-Hartman <[email protected]>2021-06-17 15:39:33 +0200
commit03026197bb657d784220b040c6173267a0375741 (patch)
tree8937a8bac7d684384bab3e0aebc6988d0780328a
parent2b537cf877eae6d2f2f102052290676e40b74a1d (diff)
usb: typec: Add the missed altmode_id_remove() in typec_register_altmode()
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 <[email protected]> Acked-by: Heikki Krogerus <[email protected]> Signed-off-by: Jing Xiangfeng <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
-rw-r--r--drivers/usb/typec/class.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c
index b9429c9f65f6..aeef453aa658 100644
--- a/drivers/usb/typec/class.c
+++ b/drivers/usb/typec/class.c
@@ -517,8 +517,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;