summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/udc
diff options
context:
space:
mode:
authorKrzysztof Opasiak <k.opasiak@samsung.com>2016-05-05 10:46:05 +0200
committerFelipe Balbi <felipe.balbi@linux.intel.com>2016-05-31 10:02:53 +0300
commitf1bddbb3de60872acc2446eee97dbeb0a6d57acb (patch)
treefb0786404eafa9f6e3dd7d8c840ea1e17700dd40 /drivers/usb/gadget/udc
parent1a695a905c18548062509178b98bc91e67510864 (diff)
downloadop-kernel-dev-f1bddbb3de60872acc2446eee97dbeb0a6d57acb.zip
op-kernel-dev-f1bddbb3de60872acc2446eee97dbeb0a6d57acb.tar.gz
usb: gadget: Fix binding to UDC via configfs interface
By default user could store only valid UDC name in configfs UDC attr by doing: echo $UDC_NAME > UDC Commit (855ed04 "usb: gadget: udc-core: independent registration of gadgets and gadget drivers") broke this behavior and allowed to store any arbitrary string in UDC file and udc core was waiting for such controller to appear. echo "any arbitrary string here" > UDC This commit fix this by adding a flag which prevents configfs gadget from being added to list of pending drivers if UDC with given name has not been found. Signed-off-by: Krzysztof Opasiak <k.opasiak@samsung.com> Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Diffstat (limited to 'drivers/usb/gadget/udc')
-rw-r--r--drivers/usb/gadget/udc/udc-core.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/usb/gadget/udc/udc-core.c b/drivers/usb/gadget/udc/udc-core.c
index 6e8300d..e1b2dce 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -603,11 +603,15 @@ int usb_gadget_probe_driver(struct usb_gadget_driver *driver)
}
}
- list_add_tail(&driver->pending, &gadget_driver_pending_list);
- pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",
- driver->function);
+ if (!driver->match_existing_only) {
+ list_add_tail(&driver->pending, &gadget_driver_pending_list);
+ pr_info("udc-core: couldn't find an available UDC - added [%s] to list of pending drivers\n",
+ driver->function);
+ ret = 0;
+ }
+
mutex_unlock(&udc_lock);
- return 0;
+ return ret;
found:
ret = udc_bind_to_driver(udc, driver);
mutex_unlock(&udc_lock);
OpenPOWER on IntegriCloud