From: Bin Meng Date: Sat, 5 Sep 2015 19:38:39 -0700 Subject: [U-Boot] [PATCH] net: eth: Do sanity test on eth dev before eth_get_ops(dev)->start Message-ID: <1441507119-14752-1-git-send-email-bmeng.cn@gmail.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de In eth_init(), eth_get_dev() can return NULL. We should do sanity test on eth dev before calling its start function. Signed-off-by: Bin Meng --- net/eth.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/net/eth.c b/net/eth.c index 26520d3..6ec3a86 100644 --- a/net/eth.c +++ b/net/eth.c @@ -370,6 +370,10 @@ int eth_init(void) eth_try_another(0); /* This will ensure the new "current" attempted to probe */ current = eth_get_dev(); + if (!current) { + printf("No ethernet found.\n"); + break; + } } while (old_current != current); return ret; -- 1.8.2.1