[PATCH master 3/3] usb: gadget: return error on missing UDC

Ahmad Fatoum a.fatoum at pengutronix.de
Fri Jul 7 05:13:54 PDT 2023


Recent sync with kernel added the match_existing_only member, but set it
no where, leading to usb_gadget_register_driver succeeding on missing
UDC. This used to be an error and we depend on it, e.g.
global.usbgadget.autostart=1 is a no-op once usb_composite_probe has
succeeded, but if we signal success in error cases, it can't be used
to retry registration.

Fixes: 14211ab8b0e1 ("usb: gadget: Update core to Linux-6.3-rc2")
Signed-off-by: Ahmad Fatoum <a.fatoum at pengutronix.de>
---
 drivers/usb/gadget/composite.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 58c10f1191f8..f55ae5698e08 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -2496,6 +2496,7 @@ int usb_composite_probe(struct usb_composite_driver *driver)
 	gadget_driver->function =  (char *) driver->name;
 	gadget_driver->driver.name = driver->name;
 	gadget_driver->max_speed = driver->max_speed;
+	gadget_driver->match_existing_only = true;
 
 	return usb_gadget_register_driver(gadget_driver);
 }
-- 
2.39.2




More information about the barebox mailing list