public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability
@ 2023-06-28 22:24 Frank Li
  2023-06-29  3:23 ` Roger Quadros
  2023-06-29  5:11 ` Ravi Gunasekaran
  0 siblings, 2 replies; 7+ messages in thread
From: Frank Li @ 2023-06-28 22:24 UTC (permalink / raw)
  To: rogerq, r-gunasekaran, imx, jun.li, Greg Kroah-Hartman,
	Elson Roy Serrao, Thinh Nguyen, Andy Shevchenko,
	Jó Ágila Bitsch, Prashanth K, Peter Chen,
	open list:USB SUBSYSTEM, open list

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@ti.com>
Signed-off-by: Frank Li <Frank.Li@nxp.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


^ permalink raw reply related	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2023-06-30 19:58 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-06-28 22:24 [PATCH 1/1] usb: gadget: call usb_gadget_check_config() to verify UDC capability Frank Li
2023-06-29  3:23 ` Roger Quadros
2023-06-29  3:40   ` [EXT] " Frank Li
2023-06-30 19:43     ` Roger Quadros
2023-06-30 19:57       ` Frank Li
2023-06-29  5:11 ` Ravi Gunasekaran
2023-06-29 14:48   ` [EXT] " Frank Li

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox