diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/eth-uclass.c | 5 | ||||
-rw-r--r-- | net/net.c | 15 |
2 files changed, 15 insertions, 5 deletions
diff --git a/net/eth-uclass.c b/net/eth-uclass.c index 396418eb390..e14695c0f16 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -75,6 +75,9 @@ struct udevice *eth_get_dev(void) struct eth_uclass_priv *uc_priv; uc_priv = eth_get_uclass_priv(); + if (!uc_priv) + return NULL; + if (!uc_priv->current) eth_errno = uclass_first_device(UCLASS_ETH, &uc_priv->current); @@ -380,7 +383,7 @@ int eth_rx(void) /* Process up to 32 packets at one time */ flags = ETH_RECV_CHECK_DEVICE; - for (i = 0; i < 32; i++) { + for (i = 0; i < ETH_PACKETS_BATCH_RECV; i++) { ret = eth_get_ops(current)->recv(current, flags, &packet); flags = 0; if (ret > 0) diff --git a/net/net.c b/net/net.c index 197fde3568d..ad7e3b3cf8e 100644 --- a/net/net.c +++ b/net/net.c @@ -338,12 +338,19 @@ void net_auto_load(void) tftp_start(TFTPGET); } -static void net_init_loop(void) +static int net_init_loop(void) { if (eth_get_dev()) memcpy(net_ethaddr, eth_get_ethaddr(), 6); + else + /* + * Not ideal, but there's no way to get the actual error, and I + * don't feel like fixing all the users of eth_get_dev to deal + * with errors. + */ + return -ENONET; - return; + return 0; } static void net_clear_handlers(void) @@ -358,7 +365,7 @@ static void net_cleanup_loop(void) net_clear_handlers(); } -void net_init(void) +int net_init(void) { static int first_call = 1; @@ -381,7 +388,7 @@ void net_init(void) first_call = 0; } - net_init_loop(); + return net_init_loop(); } /**********************************************************************/ |