summaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/composite.c
diff options
context:
space:
mode:
authorFrank Li <Frank.Li@nxp.com>2023-07-08 01:00:14 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-07-25 17:46:25 +0200
commitf4fc01af5b640bc39bd9403b5fd855345a2ad5f8 (patch)
tree332af4d99ae41da8d9aa4a8b9c1c7567cb120852 /drivers/usb/gadget/composite.c
parentusb: typec: Use sysfs_emit_at when concatenating the string (diff)
downloadlinux-f4fc01af5b640bc39bd9403b5fd855345a2ad5f8.tar.xz
linux-f4fc01af5b640bc39bd9403b5fd855345a2ad5f8.zip
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") 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>
Diffstat (limited to 'drivers/usb/gadget/composite.c')
-rw-r--r--drivers/usb/gadget/composite.c4
1 files changed, 4 insertions, 0 deletions
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;