[PATCH v2] User random address if dt sets so

Iulian Gilca
2024-10-10T20:30:20Z

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