From: Wesley Cheng Date: Sat, 10 Jul 2021 09:13:11 +0000 (-0700) Subject: usb: gadget: configfs: Check USB configuration before adding X-Git-Tag: accepted/tizen/unified/20230118.172025~6522^2~146 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7adf9e3adc398e5d5b7af91e5fdfafa70e86dd36;p=platform%2Fkernel%2Flinux-rpi.git usb: gadget: configfs: Check USB configuration before adding Ensure that the USB gadget is able to support the configuration being added based on the number of endpoints required from all interfaces. This is for accounting for any bandwidth or space limitations. Signed-off-by: Wesley Cheng Link: https://lore.kernel.org/r/1625908395-5498-3-git-send-email-wcheng@codeaurora.org Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/configfs.c b/drivers/usb/gadget/configfs.c index 15a607c..f4c7c82 100644 --- a/drivers/usb/gadget/configfs.c +++ b/drivers/usb/gadget/configfs.c @@ -1404,6 +1404,10 @@ static int configfs_composite_bind(struct usb_gadget *gadget, goto err_purge_funcs; } } + ret = usb_gadget_check_config(cdev->gadget); + if (ret) + goto err_purge_funcs; + usb_ep_autoconfig_reset(cdev->gadget); } if (cdev->use_os_string) {