[U-Boot] [PATCH] USB: fix create_pipe()

Sergei Shtylyov sshtylyov at ru.mvista.com
Wed May 26 19:26:43 CEST 2010


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 at ru.mvista.com>

---
 include/usb.h |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Index: u-boot/include/usb.h
===================================================================
--- u-boot.orig/include/usb.h
+++ u-boot/include/usb.h
@@ -259,7 +259,7 @@ int usb_set_interface(struct usb_device 
  */
 /* 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)
 


More information about the U-Boot mailing list