usb: gadget: fsl: fix null pointer checking
authorRan Wang <ran.wang_1@nxp.com>
Fri, 16 Oct 2020 04:33:26 +0000 (12:33 +0800)
committerFelipe Balbi <balbi@kernel.org>
Tue, 27 Oct 2020 08:57:24 +0000 (10:57 +0200)
fsl_ep_fifo_status() should return error if _ep->desc is null.

Fixes: 75eaa498c99e (“usb: gadget: Correct NULL pointer checking in fsl gadget”)
Reviewed-by: Peter Chen <peter.chen@nxp.com>
Signed-off-by: Ran Wang <ran.wang_1@nxp.com>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/gadget/udc/fsl_udc_core.c

index de528e3..ad6ff9c 100644 (file)
@@ -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);