[U-Boot] [PATCHv6 15/28] net: core: Check return value of read_rom_hwaddr

Olliver Schinagl oliver at schinagl.nl
Mon May 15 08:02:31 UTC 2017


Currently, we silently ignore the return value of netops->read_rom_hwaddr().
This naturally is bad and we should check if the code ran successfully.

Signed-off-by: Olliver Schinagl <oliver at schinagl.nl>
---
 net/eth-uclass.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/net/eth-uclass.c b/net/eth-uclass.c
index c88b032868..024136a7cb 100644
--- a/net/eth-uclass.c
+++ b/net/eth-uclass.c
@@ -511,8 +511,8 @@ static int eth_post_probe(struct udevice *dev)
 		pdata->enetaddr_src = ENETADDR_SRC_EEPROM;
 	else
 		/* Check if the device driver has a MAC address */
-		if (eth_get_ops(dev)->read_rom_hwaddr) {
-			eth_get_ops(dev)->read_rom_hwaddr(dev);
+		if (eth_get_ops(dev)->read_rom_hwaddr &&
+		    !eth_get_ops(dev)->read_rom_hwaddr(dev)) {
 			pdata->enetaddr_src = ENETADDR_SRC_DRIVER;
 		}
 
-- 
2.11.0



More information about the U-Boot mailing list