]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[TG3]: Fix 5704 single-port mode
authorMichael Chan <mchan@broadcom.com>
Wed, 14 Dec 2005 05:09:54 +0000 (21:09 -0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 14 Dec 2005 05:09:54 +0000 (21:09 -0800)
If the dual-port 5704 is configured as a single-port device with
only one PCI function, it would trigger a BUG() condition in
tg3_find_5704_peer(). This fixes the problem by returning its
own pdev if the peer cannot be found.

Signed-off-by: Michael Chan <mchan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tg3.c

index 6b7ab4b7275295bd84f8cd830f08a8e85907339c..a143c18c7bc6d997cb83290ebded6e5335f41ba2 100644 (file)
@@ -10443,8 +10443,13 @@ static struct pci_dev * __devinit tg3_find_5704_peer(struct tg3 *tp)
                        break;
                pci_dev_put(peer);
        }
-       if (!peer || peer == tp->pdev)
-               BUG();
+       /* 5704 can be configured in single-port mode, set peer to
+        * tp->pdev in that case.
+        */
+       if (!peer) {
+               peer = tp->pdev;
+               return peer;
+       }
 
        /*
         * We don't need to keep the refcount elevated; there's no way