[PATCH v2] User random address if dt sets so

From: Iulian Gilca
Date: Thu Oct 10 2024 - 16:30:29 EST


---
net/core/of_net.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/net/core/of_net.c b/net/core/of_net.c
index aa4acdffc710..a11f1c12c395 100644
--- a/net/core/of_net.c
+++ b/net/core/of_net.c
@@ -142,7 +142,11 @@ int of_get_mac_address(struct device_node *np, u8 *addr)
if (!ret)
return 0;

- ret = of_get_mac_addr(np, "random-address", addr);
+ if (of_find_property(np, "random-address", NULL)) {
+ eth_random_addr(addr);
+ return 0;
+ }
+
if (!ret)
return 0;

--
2.43.0