]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: mt76: fix MAC address for non OF pcie cards
authorRosen Penev <rosenp@gmail.com>
Mon, 6 Jul 2026 23:28:57 +0000 (16:28 -0700)
committerFelix Fietkau <nbd@nbd.name>
Wed, 22 Jul 2026 06:12:24 +0000 (06:12 +0000)
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/30a90714-02d8-45f2-a7f1-4cfe0627d50b@skade.local/

Reported-by: Klara Modin <klarasmodin@gmail.com>
Closes: https://lore.kernel.org/all/ajRmlyx_AEGybykL@soda.int.kasm.eu/
Reported-by: Tobias Klausmann <klausman@schwarzvogel.de>
Fixes: 31ee1582717e ("wifi: mt76: fix of_get_mac_address error handling")
Signed-off-by: Rosen Penev <rosenp@gmail.com>
Tested-by: Tobias Klausmann <klausman@schwarzvogel.de>
Tested-by: Klara Modin <klarasmodin@gmail.com>
Tested-by: John Rowley <lkml@johnrowley.me>
Link: https://patch.msgid.link/20260706232857.807044-1-rosenp@gmail.com
Signed-off-by: Felix Fietkau <nbd@nbd.name>
drivers/net/wireless/mediatek/mt76/eeprom.c

index b99d7452800fdee89da428103d07a562f43195a7..afdb73661866e9c2b17b98a885eee3ad9940fdce 100644 (file)
@@ -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",