summaryrefslogtreecommitdiffstats
path: root/package/kernel/mt76/patches/100-Revert-of-net-pass-the-dst-buffer-to-of_get_mac_addr.patch
blob: ede3cca1f075718c384e4f0163aa6553c35c7599 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From: Felix Fietkau <nbd@nbd.name>
Date: Tue, 23 Nov 2021 17:01:45 +0100
Subject: [PATCH] Revert "of: net: pass the dst buffer to of_get_mac_address()"

This reverts commit 4932c5d80153c336c77dbe8d7af9f8fdd879d01f.
---

--- a/eeprom.c
+++ b/eeprom.c
@@ -107,9 +107,15 @@ mt76_eeprom_override(struct mt76_phy *ph
 {
 	struct mt76_dev *dev = phy->dev;
 
+#ifdef CONFIG_OF
 	struct device_node *np = dev->dev->of_node;
+	const u8 *mac = NULL;
 
-	of_get_mac_address(np, phy->macaddr);
+	if (np)
+		mac = of_get_mac_address(np);
+	if (!IS_ERR_OR_NULL(mac))
+		ether_addr_copy(phy->macaddr, mac);
+#endif
 
 	if (!is_valid_ether_addr(phy->macaddr)) {
 		eth_random_addr(phy->macaddr);