aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBjoern A. Zeeb <bz@FreeBSD.org>2026-02-05 00:20:04 +0000
committerBjoern A. Zeeb <bz@FreeBSD.org>2026-02-07 00:57:52 +0000
commit3afe9e12fb331dc698ac62f3b918d82d768a2792 (patch)
tree4deca7852695c4bf63e920c0472344673ae001dc
parentbc820edd2d7906e04e93aef8a6137991ad86f4cc (diff)
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
-rw-r--r--sys/contrib/dev/mediatek/mt76/eeprom.c9
1 files 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;
}