[patch 05/45] usb gadget: fix fsl_usb2_udc potential OOPS

Greg KH
2008-02-07T20:53:08Z

[-- Attachment #1: usb-gadget-fix-fsl_usb2_udc-potential-oops.patch --]
[-- Type: text/plain, Size: 950 bytes --]

2.6.24-stable review patch. If anyone has any objections, please let us know.

------------------
From: Li Yang <leoli@freescale.com>

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 | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

--- 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
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;
}

--