EHCI: fix off-by-one error in ehci_submit_root()
Subsystems (2)
PATCH 2/4 EHCI: fix off-by-one error in ehci_submit_root()
USB devices on the 2nd port are not detected and I get the following message:
The request port(1) is not configured
That's with default CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS value of 2. 'req->index' is 1-based, so the comparison in ehci_submit_root() can't be correct.
--- drivers/usb/host/ehci-hcd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/usb/host/ehci-hcd.c +1 -1
@@ -536,7 +536,7 @@ ehci_submit_root(struct usb_device *dev,uint32_t reg;uint32_t *status_reg; -if (le16_to_cpu (req->index) >=CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS ) { +if (le16_to_cpu (req->index) >CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS ) {printf ("The request port(%d) is not configured\n" ,le16_to_cpu (req->index) -1 );return -1 ;
PATCH 2/4 EHCI: fix off-by-one error in ehci_submit_root()
Hi,
2010/2/27 Sergei Shtylyov <[email protected]>:
Quoted 8 lines
USB devices on the 2nd port are not detected and I get the following message:
The request port(1) is not configured
That's with default
CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTSvalue of 2. 'req->index' is 1-based, so the comparison inehci_submit_root()can't be correct.Signed-off-by Sergei Shtylyov <[email protected]>
Applied to u-boot-usb
Thanks!
Remy
Quoted 22 lines
---
?drivers/usb/host/ehci-hcd.c | ? ?2 +-
?1 file changed, 1 insertion(+), 1 deletion(-)Index:
u-boot/drivers/usb/host/ehci-hcd.c
===================================================================drivers/usb/host/ehci-hcd.c +1
-1@@ -536,7 +536,7 @@ ehci_submit_root(struct usb_device *dev, ? ? ? ?uint32_t reg; ? ? ? ?uint32_t *status_reg; - ? ? ? if (le16_to_cpu(req->index) >= CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) { + ? ? ? if (le16_to_cpu(req->index) > CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS) { ? ? ? ? ? ? ? ?printf("The request port(%d) is not configured\n", ? ? ? ? ? ? ? ? ? ? ? ?le16_to_cpu(req->index) - 1); ? ? ? ? ? ? ? ?return -1;_______________________________________________
U-Boot mailing list
U-Boot at lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot