Skip to contentSkip to conversation

wifi: mt76: fix MAC address for non OF pcie cards

PATCH In review Rosen Penev 3 participants 4 messages Jul 6 – Jul 22

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 wifi: mt76: fix MAC address for non OF pcie cards

If seems the check for err is wrong as the proper macaddr gets written to from the EEPROM itself. Meaning checking err from of_get_mac_address is wrong as the proper macaddr has been written by this point.

Closes:
https://lore.kernel.org/linux-wireless/[email protected]/

Fixes 31ee1582717e ("wifi: mt76: fix of_get_mac_address error handling")

---
v2: add extra tags and target wireless

 drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/eeprom.c +1 -1
index b99d7452800f..afdb73661866 100644
@@ -181,7 +181,7 @@ mt76_eeprom_override(struct mt76_phy *phy)
 	if (err == -EPROBE_DEFER)
 		return err;
 
-	if (err) {
+	if (!is_valid_ether_addr(phy->macaddr)) {
 		eth_random_addr(phy->macaddr);
 		dev_info(dev->dev,
 			 "Invalid MAC address, using random address %pM\n",
Signature · 1 line
2.55.0
#1 lore raw

Hi,

Quoted 34 lines · Rosen Penev

If seems the check for err is wrong as the proper macaddr gets written to from the EEPROM itself. Meaning checking err from of_get_mac_address is wrong as the proper macaddr has been written by this point.

Closes:
https://lore.kernel.org/linux-wireless/[email protected]/

Fixes 31ee1582717e ("wifi: mt76: fix of_get_mac_address error handling")

---
v2: add extra tags and target wireless

 drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/eeprom.c +1 -1
index b99d7452800f..afdb73661866 100644
@@ -181,7 +181,7 @@ mt76_eeprom_override(struct mt76_phy *phy)
 	if (err == -EPROBE_DEFER)
 		return err;
 
-	if (err) {
+	if (!is_valid_ether_addr(phy->macaddr)) {
 		eth_random_addr(phy->macaddr);
 		dev_info(dev->dev,
 			 "Invalid MAC address, using random address %pM\n",
Signature · 1 line
2.55.0

Ping. No one seems to have picked this up yet, but I suppose it is holiday season.

Regards,
Klara Modin

maintainer
#2 lore raw

Hi,

Quoted 27 lines · Klara Modin
Quoted 26 lines · Rosen Penev

If seems the check for err is wrong as the proper macaddr gets written to from the EEPROM itself. Meaning checking err from of_get_mac_address is wrong as the proper macaddr has been written by this point.

Closes:
https://lore.kernel.org/linux-wireless/[email protected]/

Fixes 31ee1582717e ("wifi: mt76: fix of_get_mac_address error handling")

---
v2: add extra tags and target wireless

 drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/eeprom.c +0 -0
index b99d7452800f..afdb73661866 100644
@@ -181,7 +181,7 @@ mt76_eeprom_override(struct mt76_phy *phy)
 	if (err == -EPROBE_DEFER)
 		return err;
 
Quoted 11 lines
Quoted 8 lines
drivers/net/wireless/mediatek/mt76/eeprom.c +1 -1
-	if (err) {
+	if (!is_valid_ether_addr(phy->macaddr)) {
 		eth_random_addr(phy->macaddr);
 		dev_info(dev->dev,
 			 "Invalid MAC address, using random address %pM\n",
Signature · 1 line
2.55.0

Ping. No one seems to have picked this up yet, but I suppose it is holiday season.

It's in the mt76-fixes pull request that I just sent.

- Felix

#3 lore raw
Quoted 40 lines · Felix Fietkau

Hi,

Quoted 29 lines · Klara Modin
Quoted 28 lines · Rosen Penev

If seems the check for err is wrong as the proper macaddr gets written to from the EEPROM itself. Meaning checking err from of_get_mac_address is wrong as the proper macaddr has been written by this point.

Closes:
https://lore.kernel.org/linux-wireless/[email protected]/

Fixes 31ee1582717e ("wifi: mt76: fix of_get_mac_address error handling")

---
v2: add extra tags and target wireless

 drivers/net/wireless/mediatek/mt76/eeprom.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/wireless/mediatek/mt76/eeprom.c +1 -1
index b99d7452800f..afdb73661866 100644
@@ -181,7 +181,7 @@ mt76_eeprom_override(struct mt76_phy *phy)
 	if (err == -EPROBE_DEFER)
 		return err;
-	if (err) {
+	if (!is_valid_ether_addr(phy->macaddr)) {
 		eth_random_addr(phy->macaddr);
Quoted 8 lines
Quoted 5 lines
drivers/net/wireless/mediatek/mt76/eeprom.c +0 -0
 		dev_info(dev->dev,
 			 "Invalid MAC address, using random address %pM\n",
Signature · 1 line
2.55.0

Ping. No one seems to have picked this up yet, but I suppose it is holiday season.

Quoted 3 lines

It's in the mt76-fixes pull request that I just sent.

- Felix

Thanks!