[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230628222437.3188441-1-Frank.Li@nxp.com>
Date: Wed, 28 Jun 2023 18:24:36 -0400
From: Frank Li <Frank.Li@....com>
To: rogerq@...nel.org, r-gunasekaran@...com, imx@...ts.linux.dev,
jun.li@....com, Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Elson Roy Serrao <quic_eserrao@...cinc.com>,
Thinh Nguyen <Thinh.Nguyen@...opsys.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Jó Ágila Bitsch <jgilab@...il.com>,
Prashanth K <quic_prashk@...cinc.com>,
Peter Chen <peter.chen@...nel.org>,
linux-usb@...r.kernel.org (open list:USB SUBSYSTEM),
linux-kernel@...r.kernel.org (open list)
Subject: [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability
The legacy gadget driver omitted calling usb_gadget_check_config()
to ensure that the USB device controller (UDC) has adequate resources,
including sufficient endpoint numbers and types, to support the given
configuration.
Previously, usb_add_config() was solely invoked by the legacy gadget
driver. Adds the necessary usb_gadget_check_config() after the bind()
operation to fix the issue.
Fixes: dce49449e04f ("usb: cdns3: allocate TX FIFO size according to composite EP number")
Reported-by: Ravi Gunasekaran <r-gunasekaran@...com>
Signed-off-by: Frank Li <Frank.Li@....com>
---
drivers/usb/gadget/composite.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index 1b3489149e5e..dd9b90481b4c 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -1125,6 +1125,10 @@ int usb_add_config(struct usb_composite_dev *cdev,
goto done;
status = bind(config);
+
+ if (status == 0)
+ status = usb_gadget_check_config(cdev->gadget);
+
if (status < 0) {
while (!list_empty(&config->functions)) {
struct usb_function *f;
--
2.34.1
Powered by blists - more mailing lists