FROMGIT: 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: 8a37d87d72
("usb: typec: Bus type for alternate modes")
Cc: stable <stable@vger.kernel.org>
Acked-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Jing Xiangfeng <jingxiangfeng@huawei.com>
Link: https://lore.kernel.org/r/20210617073226.47599-1-jingxiangfeng@huawei.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
(cherry picked from commit 03026197bb657d784220b040c6173267a0375741
https://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb.git usb-next)
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: I0a0b9880604f6da396351f7b82322394e23604db
This commit is contained in:

committed by
Greg Kroah-Hartman

parent
57cb3d1f7b
commit
15fdca98a0
@@ -572,8 +572,10 @@ typec_register_altmode(struct device *parent,
|
|||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
alt = kzalloc(sizeof(*alt), GFP_KERNEL);
|
alt = kzalloc(sizeof(*alt), GFP_KERNEL);
|
||||||
if (!alt)
|
if (!alt) {
|
||||||
|
altmode_id_remove(parent, id);
|
||||||
return ERR_PTR(-ENOMEM);
|
return ERR_PTR(-ENOMEM);
|
||||||
|
}
|
||||||
|
|
||||||
alt->adev.svid = desc->svid;
|
alt->adev.svid = desc->svid;
|
||||||
alt->adev.mode = desc->mode;
|
alt->adev.mode = desc->mode;
|
||||||
|
Reference in New Issue
Block a user