]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
USB: fix create_pipe()
authorSergei Shtylyov <sshtylyov@ru.mvista.com>
Wed, 26 May 2010 17:26:43 +0000 (21:26 +0400)
committerRemy Bohmer <linux@bohmer.net>
Thu, 27 May 2010 18:59:48 +0000 (20:59 +0200)
create_pipe() can give wrong result if an expression is passed as the 'endpoint'
argument -- due to missing parentheses.

Thanks to Martin Mueller for finding the bug and providing the patch.

Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com>
include/usb.h

index a1f09d4d7ae1e48c0ecee71629ba624e340bbe90..bc4ccfe150622cdd6ec5d9c5d3b369900e54dc12 100644 (file)
@@ -259,7 +259,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate);
  */
 /* Create various pipes... */
 #define create_pipe(dev,endpoint) \
-               (((dev)->devnum << 8) | (endpoint << 15) | \
+               (((dev)->devnum << 8) | ((endpoint) << 15) | \
                ((dev)->speed << 26) | (dev)->maxpacketsize)
 #define default_pipe(dev) ((dev)->speed << 26)