Skip to content

Commit

Permalink
usb: gadget: call usb_gadget_check_config() to verify UDC capability
Browse files Browse the repository at this point in the history
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: dce4944 ("usb: cdns3: allocate TX FIFO size according to composite EP number")
Cc: stable <stable@kernel.org>
Reported-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Link: https://lore.kernel.org/r/20230707230015.494999-1-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
  • Loading branch information
Frank Li authored and Greg Kroah-Hartman committed Jul 25, 2023
1 parent 609fded commit f4fc01a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions drivers/usb/gadget/composite.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f4fc01a

Please sign in to comment.