]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
net: Only access network devices after init
authorAlexander Graf <agraf@suse.de>
Thu, 15 Mar 2018 14:07:09 +0000 (15:07 +0100)
committerJoe Hershberger <joe.hershberger@ni.com>
Thu, 22 Mar 2018 20:05:31 +0000 (15:05 -0500)
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 <agraf@suse.de>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
net/eth-uclass.c

index d30b04ba862a8b90d370b97116a7683c1d752f36..240b5965345543ff679ae925a2401f9c254b6e8b 100644 (file)
@@ -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 */