Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config

Previously, the cdns3_gadget_check_config() function in the cdns3 driver
mistakenly calculated the ep_buf_size by considering only one
configuration's endpoint information because "claimed" will be clear after
call usb_gadget_check_config().

The fix involves checking the private flags EP_CLAIMED instead of relying
on the "claimed" flag.

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>
Acked-by: Peter Chen <peter.chen@kernel.org>
Tested-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
Link: https://lore.kernel.org/r/20230707230015.494999-2-Frank.Li@nxp.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Frank Li and committed by
Greg Kroah-Hartman
2627335a f4fc01af

+3 -1
+3 -1
drivers/usb/cdns3/cdns3-gadget.c
··· 3015 3015 static int cdns3_gadget_check_config(struct usb_gadget *gadget) 3016 3016 { 3017 3017 struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget); 3018 + struct cdns3_endpoint *priv_ep; 3018 3019 struct usb_ep *ep; 3019 3020 int n_in = 0; 3020 3021 int total; 3021 3022 3022 3023 list_for_each_entry(ep, &gadget->ep_list, ep_list) { 3023 - if (ep->claimed && (ep->address & USB_DIR_IN)) 3024 + priv_ep = ep_to_cdns3_ep(ep); 3025 + if ((priv_ep->flags & EP_CLAIMED) && (ep->address & USB_DIR_IN)) 3024 3026 n_in++; 3025 3027 } 3026 3028