wifi: mt76: mt7915: honour the valid flag in efuse block reads

The EFUSE_ACCESS response carries a valid flag that was ignored, so
reading an unwritten efuse block copied garbage into the eeprom data.
Return -ENODATA for invalid blocks and leave the corresponding eeprom
range untouched (zero-initialised) when loading the full eeprom from
efuse.

Fixes: e57b7901469f ("mt76: add mac80211 driver for MT7915 PCIe-based chipsets")
Signed-off-by: Felix Fietkau <[email protected]>
This commit is contained in:
Felix Fietkau
2026-08-01 17:46:21 +02:00
parent ba81b0234b
commit 5781c92d13
2 changed files with 7 additions and 2 deletions
+2 -2
View File
@@ -150,11 +150,11 @@ static int mt7915_eeprom_load(struct mt7915_dev *dev)
if (free_block_num >= 29)
return -EINVAL;
/* read eeprom data from efuse */
/* read eeprom data from efuse, skipping unwritten blocks */
block_num = DIV_ROUND_UP(eeprom_size, eeprom_blk_size);
for (i = 0; i < block_num; i++) {
ret = mt7915_mcu_get_eeprom(dev, i * eeprom_blk_size, NULL);
if (ret < 0)
if (ret < 0 && ret != -ENODATA)
return ret;
}
}
+5
View File
@@ -2957,6 +2957,11 @@ int mt7915_mcu_get_eeprom(struct mt7915_dev *dev, u32 offset, u8 *read_buf)
return -EINVAL;
}
if (!le32_to_cpu(res->valid)) {
dev_kfree_skb(skb);
return -ENODATA;
}
if (!buf) {
u32 addr = le32_to_cpu(res->addr);