mirror of
https://github.com/outbackdingo/mt76.git
synced 2026-10-24 13:26:48 +00:00
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:
+2
-2
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user