From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Beno=C3=AEt_Th=C3=A9baudeau?= Date: Fri, 10 Aug 2012 19:56:21 +0200 (CEST) Subject: [U-Boot] [PATCH] eth_write_hwaddr: Return error for invalid MACs Message-ID: <821911102.2280760.1344621381185.JavaMail.root@advansee.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de If dev->enetaddr was supposed to be set with dev->write_hwaddr() but the MAC address was not valid, return an error. Signed-off-by: Beno?t Th?baudeau Cc: Joe Hershberger --- {u-boot-4d3c95f.orig => u-boot-4d3c95f}/net/eth.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git u-boot-4d3c95f.orig/net/eth.c u-boot-4d3c95f/net/eth.c index 1a11ce1..174361f 100644 --- u-boot-4d3c95f.orig/net/eth.c +++ u-boot-4d3c95f/net/eth.c @@ -222,9 +222,12 @@ int eth_write_hwaddr(struct eth_device *dev, const char *base_name, } if (dev->write_hwaddr && - !eth_mac_skip(eth_number) && - is_valid_ether_addr(dev->enetaddr)) + !eth_mac_skip(eth_number)) { + if (!is_valid_ether_addr(dev->enetaddr)) + return -1; + ret = dev->write_hwaddr(dev); + } return ret; }