From 6c7dd4ba33be413ab5f689c434c797a99225afc3 Mon Sep 17 00:00:00 2001 From: Mike Lockwood Date: Tue, 2 Aug 2011 11:13:48 -0400 Subject: [PATCH] usb: gadget: android: Only call ctrlrequest callback on enabled functions Signed-off-by: Mike Lockwood --- drivers/usb/gadget/android.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) 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) -- 2.34.1