From: Roger Quadros Date: Mon, 13 Mar 2017 13:04:33 +0000 (+0200) Subject: net: don't override ethernet address environment X-Git-Tag: v2017.05-rc1~37 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=ee6fdfadaafeb50a2e7d2a5a4f978332b5198000;p=u-boot net: don't override ethernet address environment If the ethernet address environment is set with a valid ethernet address prevent overriding it as it is most likely set by the user and he/she doesn't want board code to automatically override it whatsoever. Signed-off-by: Roger Quadros Reviewed-by: Tom Rini --- diff --git a/net/eth_common.c b/net/eth_common.c index e9d3c66741..58fa295771 100644 --- a/net/eth_common.c +++ b/net/eth_common.c @@ -34,6 +34,9 @@ int eth_setenv_enetaddr(const char *name, const uchar *enetaddr) { char buf[ARP_HLEN_ASCII + 1]; + if (eth_getenv_enetaddr(name, (uchar *)buf)) + return -EEXIST; + sprintf(buf, "%pM", enetaddr); return setenv(name, buf);