diff mbox series

usb: dwc3: gadget: fix status value on remove_request

Message ID 20221108191445.2883161-1-m.grzeschik@pengutronix.de
State New
Headers show
Series usb: dwc3: gadget: fix status value on remove_request | expand

Commit Message

Michael Grzeschik Nov. 8, 2022, 7:14 p.m. UTC
Since the patch b44c0e7fef51 ("usb: dwc3: gadget: conditionally remove
requests") the driver is now returning different request status values
in different conditions of disabled endpoint and stopped transfers.
The patch however has swapped the actual status results they should
have. We fix this now with this patch.

Fixes: b44c0e7fef51 ("usb: dwc3: gadget: conditionally remove requests")
Cc: stable@vger.kernel.org
Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
---

I had this patch prepared already, but forgot about it. Sorry about the
delay. Thanks for catching up on this, Thinh!

mgr

 drivers/usb/dwc3/gadget.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Thinh Nguyen Nov. 8, 2022, 7:30 p.m. UTC | #1
On Tue, Nov 08, 2022, Michael Grzeschik wrote:
> Since the patch b44c0e7fef51 ("usb: dwc3: gadget: conditionally remove
> requests") the driver is now returning different request status values
> in different conditions of disabled endpoint and stopped transfers.
> The patch however has swapped the actual status results they should
> have. We fix this now with this patch.
> 
> Fixes: b44c0e7fef51 ("usb: dwc3: gadget: conditionally remove requests")
> Cc: stable@vger.kernel.org
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>
> ---
> 
> I had this patch prepared already, but forgot about it. Sorry about the
> delay. Thanks for catching up on this, Thinh!
> 
> mgr

NP, I wasn't sure you would prepare it any time soon. It breaks some of
our tests, so I went ahead and pushed the fix. Greg already picked it
up.

> 
>  drivers/usb/dwc3/gadget.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
> index ecddb144871bec..cd5ace438d40ee 100644
> --- a/drivers/usb/dwc3/gadget.c
> +++ b/drivers/usb/dwc3/gadget.c
> @@ -1029,7 +1029,7 @@ static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
>  		dep->endpoint.desc = NULL;
>  	}
>  
> -	dwc3_remove_requests(dwc, dep, -ECONNRESET);
> +	dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
>  
>  	dep->stream_capable = false;
>  	dep->type = 0;
> @@ -2375,7 +2375,7 @@ static void dwc3_stop_active_transfers(struct dwc3 *dwc)
>  		if (!dep)
>  			continue;
>  
> -		dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
> +		dwc3_remove_requests(dwc, dep, -ECONNRESET);
>  	}
>  }

That doesn't look right. What about soft-disconnect? What conditions
that dwc3_stop_active_transfers() is called that's not supposed to
return -ESHUTDOWN?

Thanks,
Thinh
diff mbox series

Patch

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index ecddb144871bec..cd5ace438d40ee 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -1029,7 +1029,7 @@  static int __dwc3_gadget_ep_disable(struct dwc3_ep *dep)
 		dep->endpoint.desc = NULL;
 	}
 
-	dwc3_remove_requests(dwc, dep, -ECONNRESET);
+	dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
 
 	dep->stream_capable = false;
 	dep->type = 0;
@@ -2375,7 +2375,7 @@  static void dwc3_stop_active_transfers(struct dwc3 *dwc)
 		if (!dep)
 			continue;
 
-		dwc3_remove_requests(dwc, dep, -ESHUTDOWN);
+		dwc3_remove_requests(dwc, dep, -ECONNRESET);
 	}
 }