]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
net: zynq_gem: Do not return -ENOSYS on success
authorOlliver Schinagl <oliver@schinagl.nl>
Mon, 3 Apr 2017 14:18:53 +0000 (16:18 +0200)
committerMichal Simek <monstr@monstr.eu>
Thu, 20 Jul 2017 08:22:44 +0000 (10:22 +0200)
The .read_rom_hwaddr net_ops hook does not check the return value, which
is why it was never caught that we are currently returning 0 if the
read_rom_hwaddr function return -ENOSYS and -ENOSYS otherwise.

In this case we can simplify this by just returning the result of the
function.

Signed-off-by: Olliver Schinagl <oliver@schinagl.nl>
Acked-by: Joe Hershberger <joe.hershberger@ni.com>
Acked-by: Michal Simek <michal.simek@xilinx.com>
drivers/net/zynq_gem.c

index 9c17d08d584dbe31a4f0a76a98bd7c221eba2cfe..235e061a4eef28099ecaed279d6e8d542c051c37 100644 (file)
@@ -593,14 +593,12 @@ __weak int zynq_board_read_rom_ethaddr(unsigned char *ethaddr)
 
 static int zynq_gem_read_rom_mac(struct udevice *dev)
 {
-       int retval;
        struct eth_pdata *pdata = dev_get_platdata(dev);
 
-       retval = zynq_board_read_rom_ethaddr(pdata->enetaddr);
-       if (retval == -ENOSYS)
-               retval = 0;
+       if (!pdata)
+               return -ENOSYS;
 
-       return retval;
+       return zynq_board_read_rom_ethaddr(pdata->enetaddr);
 }
 
 static int zynq_gem_miiphy_read(struct mii_dev *bus, int addr,