]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
ARM: OMAP3: Refactors the SM911x driver
authorSteve Sakoman <sakoman@gmail.com>
Tue, 20 Oct 2009 16:21:18 +0000 (18:21 +0200)
committerTom Rix <Tom.Rix@windriver.com>
Sat, 24 Oct 2009 14:55:25 +0000 (09:55 -0500)
Move the test up in the function to not hang on systems without ethernet.

Signed-off-by: Steve Sakoman <sakoman@gmail.com>
Acked-by: Ben Warren <biggerbadderben@gmail.com>
drivers/net/smc911x.c

index b106ec97320a17c530650aa8bcafb6e6df626369..df7347897b125412b734243981bfea716934f71e 100644 (file)
@@ -249,6 +249,12 @@ int smc911x_initialize(u8 dev_num, int base_addr)
 
        dev->iobase = base_addr;
 
+       /* Try to detect chip. Will fail if not present. */
+       if (smc911x_detect_chip(dev)) {
+               free(dev);
+               return 0;
+       }
+
        addrh = smc911x_get_mac_csr(dev, ADDRH);
        addrl = smc911x_get_mac_csr(dev, ADDRL);
        dev->enetaddr[0] = addrl;
@@ -264,12 +270,6 @@ int smc911x_initialize(u8 dev_num, int base_addr)
        dev->recv = smc911x_rx;
        sprintf(dev->name, "%s-%hu", DRIVERNAME, dev_num);
 
-       /* Try to detect chip. Will fail if not present. */
-       if (smc911x_detect_chip(dev)) {
-               free(dev);
-               return 0;
-       }
-
        eth_register(dev);
        return 0;
 }