git: 3afe9e12fb33 - main - mt76: fix a check wrongly giving us random ether addresses all the time

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Sat, 07 Feb 2026 00:58:26 UTC
The branch main has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=3afe9e12fb331dc698ac62f3b918d82d768a2792

commit 3afe9e12fb331dc698ac62f3b918d82d768a2792
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2026-02-05 00:20:04 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2026-02-07 00:57:52 +0000

    mt76: fix a check wrongly giving us random ether addresses all the time
    
    Do not cover the is_valid_ether_addr() check under CONFIG_OF.
    Unclear if this is an initial porting or a merging error before the
    driver hit the FreeBSD src tree.
    The end result was that we always got a random link-layer address,
    while the individual drivers may have setup phy->macaddr and this
    function would only overwride if given in device tree.
    Only if both, driver and and the OF backup, fail then go and use
    the random link-layer address.
    
    While here adjust printing the random link-layer address using
    a FreeBSD format specifier and not the unsupported Linux one.
    
    Fixes:          6c92544d7c97
    Sponsored by:   The FreeBSD Foundation
    MFC after:      3 days
---
 sys/contrib/dev/mediatek/mt76/eeprom.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/sys/contrib/dev/mediatek/mt76/eeprom.c b/sys/contrib/dev/mediatek/mt76/eeprom.c
index 1d5b95226a16..99e1bca3c19f 100644
--- a/sys/contrib/dev/mediatek/mt76/eeprom.c
+++ b/sys/contrib/dev/mediatek/mt76/eeprom.c
@@ -186,16 +186,19 @@ mt76_eeprom_override(struct mt76_phy *phy)
 	err = of_get_mac_address(np, phy->macaddr);
 	if (err == -EPROBE_DEFER)
 		return err;
+#endif
 
 	if (!is_valid_ether_addr(phy->macaddr)) {
-#endif
 		eth_random_addr(phy->macaddr);
 		dev_info(dev->dev,
+#if defined(__linux__)
 			 "Invalid MAC address, using random address %pM\n",
 			 phy->macaddr);
-#if defined(CONFIG_OF)
-	}
+#elif defined(__FreeBSD__)
+			 "Invalid MAC address, using random address %6D\n",
+			 phy->macaddr, ":");
 #endif
+	}
 
 	return 0;
 }