]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
usb gadget: fix fsl_usb2_udc potential OOPS
authorLi Yang <leoli@freescale.com>
Fri, 1 Feb 2008 23:16:43 +0000 (15:16 -0800)
committerGreg Kroah-Hartman <gregkh@suse.de>
Fri, 8 Feb 2008 19:46:21 +0000 (11:46 -0800)
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 <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/usb/gadget/fsl_usb2_udc.c

index 038e7d7b4da1c13845ae944f07b5aaeabf27b0ec..d59eb92a847df48cabc8c8145196a36534ec73de 100644 (file)
@@ -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;
        }