Merge "usb: pd: Support vdm messages for XR smartviewer"
diff --git a/drivers/usb/gadget/function/f_qdss.c b/drivers/usb/gadget/function/f_qdss.c
index 312ae24..76a5896 100644
--- a/drivers/usb/gadget/function/f_qdss.c
+++ b/drivers/usb/gadget/function/f_qdss.c
@@ -1,7 +1,7 @@
/*
* f_qdss.c -- QDSS function Driver
*
- * Copyright (c) 2012-2018, The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2018, 2020, The Linux Foundation. All rights reserved.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -1129,8 +1129,21 @@
static void usb_qdss_free_inst(struct usb_function_instance *fi)
{
struct usb_qdss_opts *opts;
+ struct usb_qdss_ch *ch;
+ unsigned long flags;
opts = container_of(fi, struct usb_qdss_opts, func_inst);
+ spin_lock_irqsave(&qdss_lock, flags);
+ list_for_each_entry(ch, &usb_qdss_ch_list, list) {
+ if (!strcmp(opts->channel_name, ch->name)) {
+ list_del(&ch->list);
+ break;
+ }
+ }
+
+ spin_unlock_irqrestore(&qdss_lock, flags);
+ kfree(opts->channel_name);
+ destroy_workqueue(opts->usb_qdss->wq);
kfree(opts->usb_qdss);
kfree(opts);
}