Re: [PATCH v4] usb: udc: remove warning when queue disabled ep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 15, 2024 at 10:01:44AM +0800, yuan linyu wrote:
> It is possible trigger below warning message from mass storage function,
> 
> WARNING: CPU: 6 PID: 3839 at drivers/usb/gadget/udc/core.c:294 usb_ep_queue+0x7c/0x104
> pc : usb_ep_queue+0x7c/0x104
> lr : fsg_main_thread+0x494/0x1b3c
> 
> Root cause is mass storage function try to queue request from main thread,
> but other thread may already disable ep when function disable.
> 
> As there is no function failure in the driver, in order to avoid effort
> to fix warning, change WARN_ON_ONCE() in usb_ep_queue() to pr_debug().
> 
> Suggested-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>
> Cc: <stable@xxxxxxxxxxxxxxx>
> Signed-off-by: yuan linyu <yuanlinyu@xxxxxxxxxxx>
> ---

Reviewed-by: Alan Stern <stern@xxxxxxxxxxxxxxxxxxx>

> v4: add version info in subject
> v3: add more debug info, remove two line commit description
>     https://lore.kernel.org/linux-usb/20240315015854.2715357-1-yuanlinyu@xxxxxxxxxxx/
> v2: change WARN_ON_ONCE() in usb_ep_queue() to pr_debug()
>     https://lore.kernel.org/linux-usb/20240315013019.2711135-1-yuanlinyu@xxxxxxxxxxx/
> v1: https://lore.kernel.org/linux-usb/20240314065949.2627778-1-yuanlinyu@xxxxxxxxxxx/
> 
>  drivers/usb/gadget/udc/core.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/core.c b/drivers/usb/gadget/udc/core.c
> index 9d4150124fdb..b3a9d18a8dcd 100644
> --- a/drivers/usb/gadget/udc/core.c
> +++ b/drivers/usb/gadget/udc/core.c
> @@ -292,7 +292,9 @@ int usb_ep_queue(struct usb_ep *ep,
>  {
>  	int ret = 0;
>  
> -	if (WARN_ON_ONCE(!ep->enabled && ep->address)) {
> +	if (!ep->enabled && ep->address) {
> +		pr_debug("USB gadget: queue request to disabled ep 0x%x (%s)\n",
> +				 ep->address, ep->name);
>  		ret = -ESHUTDOWN;
>  		goto out;
>  	}
> -- 
> 2.25.1
> 




[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux