From: Mike Lockwood Date: Tue, 2 Aug 2011 15:13:48 +0000 (-0400) Subject: usb: gadget: android: Only call ctrlrequest callback on enabled functions X-Git-Tag: firefly_0821_release~7613^2~351 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=6c7dd4ba33be413ab5f689c434c797a99225afc3;p=firefly-linux-kernel-4.4.55.git usb: gadget: android: Only call ctrlrequest callback on enabled functions Signed-off-by: Mike Lockwood --- diff --git a/drivers/usb/gadget/android.c b/drivers/usb/gadget/android.c index c82b43ba628c..b13633bb684a 100644 --- a/drivers/usb/gadget/android.c +++ b/drivers/usb/gadget/android.c @@ -1040,7 +1040,6 @@ android_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *c) struct android_dev *dev = _android_dev; struct usb_composite_dev *cdev = get_gadget_data(gadget); struct usb_request *req = cdev->req; - struct android_usb_function **functions = dev->functions; struct android_usb_function *f; int value = -EOPNOTSUPP; unsigned long flags; @@ -1050,7 +1049,7 @@ android_setup(struct usb_gadget *gadget, const struct usb_ctrlrequest *c) req->length = 0; gadget->ep0->driver_data = cdev; - while ((f = *functions++)) { + list_for_each_entry(f, &dev->enabled_functions, enabled_list) { if (f->ctrlrequest) { value = f->ctrlrequest(f, cdev, c); if (value >= 0)