From: Sergei Shtylyov Date: Wed, 26 May 2010 17:26:43 +0000 (+0400) Subject: USB: fix create_pipe() X-Git-Tag: v2010.06-rc2~6^2 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=d0fe1128c4451327b9cb0fac1a76efd194b078b5;p=oweals%2Fu-boot.git USB: fix create_pipe() 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 --- diff --git a/include/usb.h b/include/usb.h index a1f09d4d7a..bc4ccfe150 100644 --- a/include/usb.h +++ b/include/usb.h @@ -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)