]> git.sur5r.net Git - u-boot/commitdiff
net: rtl8169: Fix return value for rtl_send_common
authorOleksandr Tymoshenko <gonzo@bluezbox.com>
Fri, 1 Jul 2016 20:22:00 +0000 (13:22 -0700)
committerJoe Hershberger <joe.hershberger@ni.com>
Wed, 6 Jul 2016 15:45:11 +0000 (10:45 -0500)
Return value of rtl_send_common propogates unmodified all the way
up to eth_send and further to API consumer if CONFIG_API is enabled.
Previously rtl_send_common returned number of bytes sent on success
which was erroneouly detected as error condition by API consumers
that checked for operation success by comparing return value with 0.

Switch rtl_send_common to use common convention: return 0 on success
and negative value for failure.

Cc: Stephen Warren <swarren@nvidia.com>
Cc: Joe Hershberger <joe.hershberger@ni.com>
Signed-off-by: Oleksandr Tymoshenko <gonzo@bluezbox.com>
Reviewed-by: Simon Glass <sjg@chromium.org>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
drivers/net/rtl8169.c

index 843b083f8f90460b9992f9f232003a06bc82b119..1cc0b40935c53bff2e4426a4282b7a7a28d8870e 100644 (file)
@@ -666,12 +666,12 @@ static int rtl_send_common(pci_dev_t dev, unsigned long dev_iobase,
                puts("tx timeout/error\n");
                printf("%s elapsed time : %lu\n", __func__, currticks()-stime);
 #endif
-               ret = 0;
+               ret = -ETIMEDOUT;
        } else {
 #ifdef DEBUG_RTL8169_TX
                puts("tx done\n");
 #endif
-               ret = length;
+               ret = 0;
        }
        /* Delay to make net console (nc) work properly */
        udelay(20);