From: Alexander Graf Date: Thu, 15 Mar 2018 14:07:09 +0000 (+0100) Subject: net: Only access network devices after init X-Git-Tag: v2018.05-rc1~11^2~4 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a532e2f2e52277635fac79cdbe4e6b5b51166de4;p=u-boot net: Only access network devices after init In the efi_loader main loop we call eth_rx() occasionally. This rx function might end up calling into devices that haven't been initialized yet, potentially resulting in a lot of transfer timeouts. Instead, let's make sure the ethernet device is actually initialized before reading from or writing to it. Signed-off-by: Alexander Graf Acked-by: Joe Hershberger --- diff --git a/net/eth-uclass.c b/net/eth-uclass.c index d30b04ba86..240b596534 100644 --- a/net/eth-uclass.c +++ b/net/eth-uclass.c @@ -336,7 +336,7 @@ int eth_send(void *packet, int length) if (!current) return -ENODEV; - if (!device_active(current)) + if (!eth_is_active(current)) return -EINVAL; ret = eth_get_ops(current)->send(current, packet, length); @@ -359,7 +359,7 @@ int eth_rx(void) if (!current) return -ENODEV; - if (!device_active(current)) + if (!eth_is_active(current)) return -EINVAL; /* Process up to 32 packets at one time */