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 <rog...@ti.com>
---
 net/eth_common.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/net/eth_common.c b/net/eth_common.c
index e9d3c66..58fa295 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);
-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to