mx35pdk: Fix error handling in board_late_init()
authorFabio Estevam <fabio.estevam@freescale.com>
Fri, 20 Sep 2013 19:30:50 +0000 (16:30 -0300)
committerStefano Babic <sbabic@denx.de>
Fri, 27 Sep 2013 11:53:35 +0000 (13:53 +0200)
If smc911x_initialize() fails we should return the error immediately.

While at it, also check the error from cpu_eth_init().

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Stefano Babic <sbabic@denx.de>
board/freescale/mx35pdk/mx35pdk.c

index 427c83a8ffd4b0b394c22c2c6533d8d92ab75f53..9fabef5af57c82666b17e65e5d1618e082889183 100644 (file)
@@ -251,14 +251,12 @@ int board_late_init(void)
 
 int board_eth_init(bd_t *bis)
 {
-       int rc = -ENODEV;
 #if defined(CONFIG_SMC911X)
-       rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+       int rc = smc911x_initialize(0, CONFIG_SMC911X_BASE);
+       if (rc)
+               return rc;
 #endif
-
-       cpu_eth_init(bis);
-
-       return rc;
+       return cpu_eth_init(bis);
 }
 
 #if defined(CONFIG_FSL_ESDHC)