diff mbox series

[2/2] usb: gadget: aspeed_udc: unlock on error in ast_udc_ep_queue()

Message ID Yq2S3aF0MPChLD/e@kili (mailing list archive)
State Accepted
Commit 3d393f0303b5120aa8c98a8ee70535ea9604ef20
Headers show
Series [1/2] usb: gadget: aspeed_udc: cleanup loop in ast_dma_descriptor_setup() | expand

Commit Message

Dan Carpenter June 18, 2022, 8:54 a.m. UTC
Call spin_unlock_irqrestore(&udc->lock, flags); before returning an
error code.

Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
---
 drivers/usb/gadget/udc/aspeed_udc.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

Comments

Neal Liu June 21, 2022, 9:24 a.m. UTC | #1
> Call spin_unlock_irqrestore(&udc->lock, flags); before returning an error code.
> 
> Fixes: 055276c13205 ("usb: gadget: add Aspeed ast2600 udc driver")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
> ---
>  drivers/usb/gadget/udc/aspeed_udc.c | 3 ++-
>  1 file changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/aspeed_udc.c
> b/drivers/usb/gadget/udc/aspeed_udc.c
> index 77376ae04224..4dead40895dd 100644
> --- a/drivers/usb/gadget/udc/aspeed_udc.c
> +++ b/drivers/usb/gadget/udc/aspeed_udc.c
> @@ -663,7 +663,8 @@ static int ast_udc_ep_queue(struct usb_ep *_ep, struct
> usb_request *_req,
>  	if (ep->ep.desc == NULL) {
>  		if ((req->req.dma % 4) != 0) {
>  			dev_warn(dev, "EP0 req dma alignment error\n");
> -			return -ESHUTDOWN;
> +			rc = -ESHUTDOWN;
> +			goto end;
>  		}

One step late, thanks for the patch anyway.
https://lore.kernel.org/lkml/HK0PR06MB3202958ED74CD706458B85CE80AF9@HK0PR06MB3202.apcprd06.prod.outlook.com/

> 
>  		ast_udc_ep0_queue(ep, req);
> --
> 2.35.1
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/aspeed_udc.c b/drivers/usb/gadget/udc/aspeed_udc.c
index 77376ae04224..4dead40895dd 100644
--- a/drivers/usb/gadget/udc/aspeed_udc.c
+++ b/drivers/usb/gadget/udc/aspeed_udc.c
@@ -663,7 +663,8 @@  static int ast_udc_ep_queue(struct usb_ep *_ep, struct usb_request *_req,
 	if (ep->ep.desc == NULL) {
 		if ((req->req.dma % 4) != 0) {
 			dev_warn(dev, "EP0 req dma alignment error\n");
-			return -ESHUTDOWN;
+			rc = -ESHUTDOWN;
+			goto end;
 		}
 
 		ast_udc_ep0_queue(ep, req);