diff options
author | Dan Carpenter <error27@gmail.com> | 2011-03-17 15:39:49 -0400 |
---|---|---|
committer | Sarah Sharp <sarah.a.sharp@linux.intel.com> | 2011-04-13 19:19:47 -0400 |
commit | 22e0487047567252d5677ff35766cd884375efc2 (patch) | |
tree | 792d135afe30d6af87d38ff5a8eb010d39c86053 /drivers/usb/host/xhci-mem.c | |
parent | 5a6c2f3ff039154872ce597952f8b8900ea0d732 (diff) |
USB: xhci: unsigned char never equals -1
There were some places that compared port_speed == -1 where port_speed
is a u8. This doesn't work unless we cast the -1 to u8. Some places
did it correctly.
Instead of using -1 directly, I've created a DUPLICATE_ENTRY define
which does the cast and is more descriptive as well.
Signed-off-by: Dan Carpenter <error27@gmail.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Diffstat (limited to 'drivers/usb/host/xhci-mem.c')
-rw-r--r-- | drivers/usb/host/xhci-mem.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index a003e79aacdc..ab7fc2b71a8c 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c | |||
@@ -846,7 +846,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, | |||
846 | * Skip ports that don't have known speeds, or have duplicate | 846 | * Skip ports that don't have known speeds, or have duplicate |
847 | * Extended Capabilities port speed entries. | 847 | * Extended Capabilities port speed entries. |
848 | */ | 848 | */ |
849 | if (port_speed == 0 || port_speed == -1) | 849 | if (port_speed == 0 || port_speed == DUPLICATE_ENTRY) |
850 | continue; | 850 | continue; |
851 | 851 | ||
852 | /* | 852 | /* |
@@ -1727,12 +1727,12 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, | |||
1727 | * found a similar duplicate. | 1727 | * found a similar duplicate. |
1728 | */ | 1728 | */ |
1729 | if (xhci->port_array[i] != major_revision && | 1729 | if (xhci->port_array[i] != major_revision && |
1730 | xhci->port_array[i] != (u8) -1) { | 1730 | xhci->port_array[i] != DUPLICATE_ENTRY) { |
1731 | if (xhci->port_array[i] == 0x03) | 1731 | if (xhci->port_array[i] == 0x03) |
1732 | xhci->num_usb3_ports--; | 1732 | xhci->num_usb3_ports--; |
1733 | else | 1733 | else |
1734 | xhci->num_usb2_ports--; | 1734 | xhci->num_usb2_ports--; |
1735 | xhci->port_array[i] = (u8) -1; | 1735 | xhci->port_array[i] = DUPLICATE_ENTRY; |
1736 | } | 1736 | } |
1737 | /* FIXME: Should we disable the port? */ | 1737 | /* FIXME: Should we disable the port? */ |
1738 | continue; | 1738 | continue; |
@@ -1831,7 +1831,7 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) | |||
1831 | for (i = 0; i < num_ports; i++) { | 1831 | for (i = 0; i < num_ports; i++) { |
1832 | if (xhci->port_array[i] == 0x03 || | 1832 | if (xhci->port_array[i] == 0x03 || |
1833 | xhci->port_array[i] == 0 || | 1833 | xhci->port_array[i] == 0 || |
1834 | xhci->port_array[i] == -1) | 1834 | xhci->port_array[i] == DUPLICATE_ENTRY) |
1835 | continue; | 1835 | continue; |
1836 | 1836 | ||
1837 | xhci->usb2_ports[port_index] = | 1837 | xhci->usb2_ports[port_index] = |