From: Steve Sakoman Date: Tue, 20 Oct 2009 16:21:18 +0000 (+0200) Subject: ARM: OMAP3: Refactors the SM911x driver X-Git-Url: http://git.dujemihanovic.xyz/?a=commitdiff_plain;h=4bc3d2afb380e78fdbb9c501d9a8da6d59eb178e;p=u-boot.git ARM: OMAP3: Refactors the SM911x driver Move the test up in the function to not hang on systems without ethernet. Signed-off-by: Steve Sakoman Acked-by: Ben Warren --- diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c index b106ec9732..df7347897b 100644 --- a/drivers/net/smc911x.c +++ b/drivers/net/smc911x.c @@ -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; }