]> git.karo-electronics.de Git - mv-sheeva.git/commitdiff
r8169: fix past rtl_chip_info array size for unknown chipsets
authorRoel Kluin <12o3l@tiscali.nl>
Thu, 17 Apr 2008 20:35:54 +0000 (22:35 +0200)
committerFrancois Romieu <romieu@fr.zoreil.com>
Thu, 17 Apr 2008 20:35:54 +0000 (22:35 +0200)
'i' is unsigned.

Signed-off-by: Roel Kluin <12o3l@tiscali.nl>
Acked-by: Francois Romieu <romieu@fr.zoreil.com>
drivers/net/r8169.c

index 3acfeeabdee1ee44cc842695b0d0ddb905e2d044..5e8ad634490ff8a6ee4ca41933472f176cff33a8 100644 (file)
@@ -1705,18 +1705,18 @@ rtl8169_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 
        rtl8169_print_mac_version(tp);
 
-       for (i = ARRAY_SIZE(rtl_chip_info) - 1; i >= 0; i--) {
+       for (i = 0; i < ARRAY_SIZE(rtl_chip_info); i++) {
                if (tp->mac_version == rtl_chip_info[i].mac_version)
                        break;
        }
-       if (i < 0) {
+       if (i == ARRAY_SIZE(rtl_chip_info)) {
                /* Unknown chip: assume array element #0, original RTL-8169 */
                if (netif_msg_probe(tp)) {
                        dev_printk(KERN_DEBUG, &pdev->dev,
                                "unknown chip version, assuming %s\n",
                                rtl_chip_info[0].name);
                }
-               i++;
+               i = 0;
        }
        tp->chipset = i;