From: Peter Chen <peter.chen@kernel.org>
To: Frank Li <Frank.Li@nxp.com>
Cc: Thinh.Nguyen@synopsys.com, andriy.shevchenko@linux.intel.com,
gregkh@linuxfoundation.org, imx@lists.linux.dev,
jgilab@gmail.com, jun.li@nxp.com, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, quic_eserrao@quicinc.com,
quic_prashk@quicinc.com, r-gunasekaran@ti.com, rogerq@kernel.org
Subject: Re: [PATCH v2 2/2] usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config
Date: Mon, 10 Jul 2023 11:38:34 +0800 [thread overview]
Message-ID: <20230710033834.GG2418446@nchen-desktop> (raw)
In-Reply-To: <20230707230015.494999-2-Frank.Li@nxp.com>
On 23-07-07 19:00:15, Frank Li wrote:
> 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")
> Reported-by: Ravi Gunasekaran <r-gunasekaran@ti.com>
> Signed-off-by: Frank Li <Frank.Li@nxp.com>
> ---
> drivers/usb/cdns3/cdns3-gadget.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/usb/cdns3/cdns3-gadget.c b/drivers/usb/cdns3/cdns3-gadget.c
> index ccfaebca6faa..3326955f6991 100644
> --- a/drivers/usb/cdns3/cdns3-gadget.c
> +++ b/drivers/usb/cdns3/cdns3-gadget.c
> @@ -2999,12 +2999,14 @@ static int cdns3_gadget_udc_stop(struct usb_gadget *gadget)
> static int cdns3_gadget_check_config(struct usb_gadget *gadget)
> {
> struct cdns3_device *priv_dev = gadget_to_cdns3_device(gadget);
> + struct cdns3_endpoint *priv_ep;
> struct usb_ep *ep;
> int n_in = 0;
> int total;
>
> list_for_each_entry(ep, &gadget->ep_list, ep_list) {
> - if (ep->claimed && (ep->address & USB_DIR_IN))
> + priv_ep = ep_to_cdns3_ep(ep);
> + if ((priv_ep->flags & EP_CLAIMED) && (ep->address & USB_DIR_IN))
> n_in++;
> }
Acked-by: Peter Chen <peter.chen@kernel.org>
--
Thanks,
Peter Chen
next prev parent reply other threads:[~2023-07-10 3:38 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-07 23:00 [PATCH v2 1/2] usb: gadget: call usb_gadget_check_config() to verify UDC capability Frank Li
2023-07-07 23:00 ` [PATCH v2 2/2] usb: cdns3: fix incorrect calculation of ep_buf_size when more than one config Frank Li
[not found] ` <f803653c-8967-b187-8339-fbec0cdeef25@web.de>
2023-07-09 8:06 ` Greg Kroah-Hartman
2023-07-10 3:38 ` Peter Chen [this message]
2023-07-10 11:14 ` Ravi Gunasekaran
2023-07-25 14:37 ` [PATCH v2 1/2] usb: gadget: call usb_gadget_check_config() to verify UDC capability Frank Li
2023-07-25 15:09 ` Greg KH
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230710033834.GG2418446@nchen-desktop \
--to=peter.chen@kernel.org \
--cc=Frank.Li@nxp.com \
--cc=Thinh.Nguyen@synopsys.com \
--cc=andriy.shevchenko@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=imx@lists.linux.dev \
--cc=jgilab@gmail.com \
--cc=jun.li@nxp.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=quic_eserrao@quicinc.com \
--cc=quic_prashk@quicinc.com \
--cc=r-gunasekaran@ti.com \
--cc=rogerq@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox