diff mbox series

[U-Boot,3/4] sunxi: board: Use eth_env_set_enetaddr_by_index()

Message ID 20191122130400.2155457-3-a.heider@gmail.com
State Superseded
Delegated to: Jagannadha Sutradharudu Teki
Headers show
Series [U-Boot,1/4] arm64: dts: sync Allwinner H6 files | expand

Commit Message

Andre Heider Nov. 22, 2019, 1:03 p.m. UTC
That helper takes care of assembling the correct name and doesn't allow
overwriting existing env vars, so drop the checks here.

Signed-off-by: Andre Heider <a.heider@gmail.com>
---
 board/sunxi/board.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)
diff mbox series

Patch

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index e3b2d13892..bb35d6b66e 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -807,14 +807,6 @@  static void setup_environment(const void *fdt)
 			if (!fdt_get_alias(fdt, ethaddr))
 				continue;
 
-			if (i == 0)
-				strcpy(ethaddr, "ethaddr");
-			else
-				sprintf(ethaddr, "eth%daddr", i);
-
-			if (env_get(ethaddr))
-				continue;
-
 			/* Non OUI / registered MAC address */
 			mac_addr[0] = (i << 4) | 0x02;
 			mac_addr[1] = (sid[0] >>  0) & 0xff;
@@ -823,7 +815,7 @@  static void setup_environment(const void *fdt)
 			mac_addr[4] = (sid[3] >>  8) & 0xff;
 			mac_addr[5] = (sid[3] >>  0) & 0xff;
 
-			eth_env_set_enetaddr(ethaddr, mac_addr);
+			eth_env_set_enetaddr_by_index("eth", i, mac_addr);
 		}
 
 		if (!env_get("serial#")) {