From: Li Yang Date: Fri, 1 Feb 2008 23:16:43 +0000 (-0800) Subject: usb gadget: fix fsl_usb2_udc potential OOPS X-Git-Tag: v2.6.24.1~41 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f3f25f6175790dc79028fd39d0eb3abce5f2222b;p=thirdparty%2Fkernel%2Fstable.git usb gadget: fix fsl_usb2_udc potential OOPS For fsl_usb2_udc driver, ep0 also has a descriptor. Current code is misleading and contains a logical mistake. Here is the patch to fix it. http://bugzilla.kernel.org/show_bug.cgi?id=9595 Signed-off-by: David Brownell Signed-off-by: Greg Kroah-Hartman Signed-off-by: Greg Kroah-Hartman --- diff --git a/drivers/usb/gadget/fsl_usb2_udc.c b/drivers/usb/gadget/fsl_usb2_udc.c index 038e7d7b4da1c..d59eb92a847df 100644 --- a/drivers/usb/gadget/fsl_usb2_udc.c +++ b/drivers/usb/gadget/fsl_usb2_udc.c @@ -776,7 +776,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags) VDBG("%s, bad params\n", __FUNCTION__); return -EINVAL; } - if (!_ep || (!ep->desc && ep_index(ep))) { + if (unlikely(!_ep || !ep->desc)) { VDBG("%s, bad ep\n", __FUNCTION__); return -EINVAL; }