Commit 75eaa498 authored by Nikhil Badola's avatar Nikhil Badola Committed by Felipe Balbi

usb: gadget: Correct NULL pointer checking in fsl gadget

Correct NULL pointer checking for endpoint descriptor
before it gets dereferenced
Signed-off-by: default avatarNikhil Badola <nikhil.badola@freescale.com>
Signed-off-by: default avatarRan Wang <ran.wang_1@nxp.com>
Reviewed-by: default avatarPeter Chen <peter.chen@nxp.com>
Signed-off-by: default avatarFelipe Balbi <felipe.balbi@linux.intel.com>
parent eb23c8b4
...@@ -1052,10 +1052,11 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep) ...@@ -1052,10 +1052,11 @@ static int fsl_ep_fifo_status(struct usb_ep *_ep)
u32 bitmask; u32 bitmask;
struct ep_queue_head *qh; struct ep_queue_head *qh;
ep = container_of(_ep, struct fsl_ep, ep); if (!_ep || _ep->desc || !(_ep->desc->bEndpointAddress&0xF))
if (!_ep || (!ep->ep.desc && ep_index(ep) != 0))
return -ENODEV; return -ENODEV;
ep = container_of(_ep, struct fsl_ep, ep);
udc = (struct fsl_udc *)ep->udc; udc = (struct fsl_udc *)ep->udc;
if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN) if (!udc->driver || udc->gadget.speed == USB_SPEED_UNKNOWN)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment