usb: diag: Do not access all the channels from set_alt handler
Access contexts of only that diag channel for which set_alt is
called. Otherwise, it might result in driver wrongly trying to
access a channel which is not included in the composition.
Change-Id: I3380d710bb372d0e4377300f44322c0866be1bcc
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/gadget/f_diag.c b/drivers/usb/gadget/f_diag.c
index e276be6..ccfd2e3 100644
--- a/drivers/usb/gadget/f_diag.c
+++ b/drivers/usb/gadget/f_diag.c
@@ -512,7 +512,6 @@
struct diag_context *dev = func_to_diag(f);
struct usb_composite_dev *cdev = f->config->cdev;
unsigned long flags;
- struct usb_diag_ch *ch;
int rc = 0;
dev->in_desc = ep_choose(cdev->gadget,
@@ -536,14 +535,9 @@
}
schedule_work(&dev->config_work);
- list_for_each_entry(ch, &usb_diag_ch_list, list) {
- struct diag_context *ctxt;
-
- ctxt = ch->priv_usb;
- ctxt->dpkts_tolaptop = 0;
- ctxt->dpkts_tomodem = 0;
- ctxt->dpkts_tolaptop_pending = 0;
- }
+ dev->dpkts_tolaptop = 0;
+ dev->dpkts_tomodem = 0;
+ dev->dpkts_tolaptop_pending = 0;
spin_lock_irqsave(&dev->lock, flags);
dev->configured = 1;