diff mbox series

[v2] User random address if dt sets so

Message ID 20241010202949.226488-1-igilca1980@gmail.com (mailing list archive)
State New
Delegated to: Netdev Maintainers
Headers show
Series [v2] User random address if dt sets so | expand

Checks

Context Check Description
netdev/tree_selection success Guessing tree name failed - patch did not apply

Commit Message

Iulian Gilca Oct. 10, 2024, 8:29 p.m. UTC
---
 net/core/of_net.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Andrew Lunn Oct. 10, 2024, 8:59 p.m. UTC | #1
On Thu, Oct 10, 2024 at 04:29:37PM -0400, Iulian Gilca wrote:

The commit message cannot be empty like this.

Please explain in detail your use case. We need to understand the
'Why?' to decide if this is the correct solution to the problem.  To
me, it seems like you have a broken MAC driver, and fixing that MAC
driver is the correct fix.

    Andrew

---
pw-bot: cr
diff mbox series

Patch

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;