]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
EHCI: fix off-by-one error in ehci_submit_root()
authorSergei Shtylyov <sshtylyov@ru.mvista.com>
Sat, 27 Feb 2010 18:32:17 +0000 (21:32 +0300)
committerRemy Bohmer <linux@bohmer.net>
Thu, 8 Apr 2010 19:39:59 +0000 (21:39 +0200)
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.

Signed-off-by: Sergei Shtylyov <sshtylyov@mvista.com>
drivers/usb/host/ehci-hcd.c

index e48819f32e4aa5b2d97b8fbeec9af437ae382136..d90a23a1f1c5af09206c437789b0338e7c0cd633 100644 (file)
@@ -536,7 +536,7 @@ ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
        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;