diff mbox series

usb: gadget: fsl: fix null pointer checking

Message ID 20201016043326.40442-1-ran.wang_1@nxp.com (mailing list archive)
State Accepted
Commit 48e7bbbbb261b007fe78aa14ae62df01d236497e
Headers show
Series usb: gadget: fsl: fix null pointer checking | expand

Commit Message

Ran Wang Oct. 16, 2020, 4:33 a.m. UTC
fsl_ep_fifo_status() should return error if _ep->desc is null.

Fixes: 75eaa498c99e (“usb: gadget: Correct NULL pointer checking in fsl gadget”)
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
---
 drivers/usb/gadget/udc/fsl_udc_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Peter Chen Oct. 16, 2020, 6:11 a.m. UTC | #1
> 
> Fixes: 75eaa498c99e (“usb: gadget: Correct NULL pointer checking in fsl
> gadget”)
> Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
> ---
>  drivers/usb/gadget/udc/fsl_udc_core.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c
> b/drivers/usb/gadget/udc/fsl_udc_core.c
> index de528e3..ad6ff9c 100644
> --- a/drivers/usb/gadget/udc/fsl_udc_core.c
> +++ b/drivers/usb/gadget/udc/fsl_udc_core.c
> @@ -1051,7 +1051,7 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
>  	u32 bitmask;
>  	struct ep_queue_head *qh;
> 
> -	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
> +	if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF))
>  		return -ENODEV;
> 

Reviewed-by: Peter Chen <peter.chen@nxp.com>

Peter
diff mbox series

Patch

diff --git a/drivers/usb/gadget/udc/fsl_udc_core.c b/drivers/usb/gadget/udc/fsl_udc_core.c
index de528e3..ad6ff9c 100644
--- a/drivers/usb/gadget/udc/fsl_udc_core.c
+++ b/drivers/usb/gadget/udc/fsl_udc_core.c
@@ -1051,7 +1051,7 @@  static int fsl_ep_fifo_status(struct usb_ep *_ep)
 	u32 bitmask;
 	struct ep_queue_head *qh;
 
-	if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
+	if (!_ep || !_ep->desc || !(_ep->desc->bEndpointAddress&0xF))
 		return -ENODEV;
 
 	ep = container_of(_ep, struct fsl_ep, ep);