[PATCH 1/7] eth: check the result of edev->get_ethaddr

Sascha Hauer s.hauer at pengutronix.de
Mon Apr 11 10:18:35 EDT 2011


Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
---
 net/eth.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/net/eth.c b/net/eth.c
index 0251e59..c5b346c 100644
--- a/net/eth.c
+++ b/net/eth.c
@@ -167,8 +167,10 @@ int eth_register(struct eth_device *edev)
 
 	if (edev->get_ethaddr(edev, ethaddr) == 0) {
 		ethaddr_to_string(ethaddr, ethaddr_str);
-		dev_info(dev, "got MAC address from EEPROM: %s\n", ethaddr_str);
-		dev_set_param(dev, "ethaddr", ethaddr_str);
+		if (is_valid_ether_addr(ethaddr)) {
+			dev_info(dev, "got MAC address from EEPROM: %s\n", ethaddr_str);
+			dev_set_param(dev, "ethaddr", ethaddr_str);
+		}
 	}
 
 	if (!eth_current) {
-- 
1.7.2.3




More information about the barebox mailing list