diff mbox series

[v4,10/10] net: don't override ethernet address environment

Message ID 1489410273-10159-11-git-send-email-rogerq@ti.com
State Accepted
Commit ee6fdfadaafeb50a2e7d2a5a4f978332b5198000
Headers show
Series am57xx-idk LCD and am571x-idk 6 port ethernet pinmux | expand

Commit Message

Roger Quadros March 13, 2017, 1:04 p.m. UTC
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 <rogerq@ti.com>
---
 net/eth_common.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Tom Rini March 17, 2017, 2:08 p.m. UTC | #1
On Mon, Mar 13, 2017 at 03:04:33PM +0200, Roger Quadros wrote:

> 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 <rogerq@ti.com>


Reviewed-by: Tom Rini <trini@konsulko.com>


-- 
Tom
Tom Rini March 21, 2017, 6:09 p.m. UTC | #2
On Mon, Mar 13, 2017 at 03:04:33PM +0200, Roger Quadros wrote:

> 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 <rogerq@ti.com>

> Reviewed-by: Tom Rini <trini@konsulko.com>


Applied to u-boot/master, thanks!

-- 
Tom
diff mbox series

Patch

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);