From b4ec73b3355e8e6f5e201c6f7e941fc8f56acb27 Mon Sep 17 00:00:00 2001 From: StanleyYP Wang Date: Thu, 12 Mar 2026 17:57:23 +0800 Subject: [PATCH] wifi: mt76: mt7996: fix the temporary buffer for calibration-free data Move the declaration of buf[] outside the for loop, since it must be preserved across iterations. Fixes: 224c7c2be578 ("wifi: mt76: mt7996: apply calibration-free data from OTP") Signed-off-by: StanleyYP Wang Signed-off-by: Shayne Chen Link: https://patch.msgid.link/20260312095724.2117448-5-shayne.chen@mediatek.com Signed-off-by: Felix Fietkau --- mt7996/mcu.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mt7996/mcu.c b/mt7996/mcu.c index 2a50ca03..d664767f 100644 --- a/mt7996/mcu.c +++ b/mt7996/mcu.c @@ -4134,6 +4134,7 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) } for (band = 0; band < __MT_MAX_BAND; band++) { + u8 buf[MT7996_EEPROM_BLOCK_SIZE]; const struct cal_free_data *cal; u16 prev_block_idx = -1; u16 adie_base; @@ -4156,13 +4157,13 @@ mt7996_mcu_get_cal_free_data(struct mt7996_dev *dev) u16 eep_offset = cal[i].eep_offs; u16 block_idx = adie_offset / MT7996_EEPROM_BLOCK_SIZE; u16 offset = adie_offset % MT7996_EEPROM_BLOCK_SIZE; - u8 buf[MT7996_EEPROM_BLOCK_SIZE]; if (is_mt7996(&dev->mt76) && band == MT_BAND1 && dev->var.type == MT7996_VAR_TYPE_444) eep_offset -= MT_EE_7977BN_OFFSET; if (prev_block_idx != block_idx) { + memset(buf, 0, sizeof(buf)); ret = mt7996_mcu_get_eeprom(dev, adie_offset, buf, MT7996_EEPROM_BLOCK_SIZE, EEPROM_MODE_EFUSE);