[bug report] wifi: mt76: mt7996: add driver for MediaTek Wi-Fi 7 (802.11be) devices

Dan Carpenter error27 at gmail.com
Sat Dec 3 04:55:53 PST 2022


Hello Shayne Chen,

The patch 98686cd21624: "wifi: mt76: mt7996: add driver for MediaTek
Wi-Fi 7 (802.11be) devices" from Nov 22, 2022, leads to the following
Smatch static checker warning:

	drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c:72 mt7996_eeprom_load()
	error: uninitialized symbol 'free_block_num'.

drivers/net/wireless/mediatek/mt76/mt7996/eeprom.c
    55 static int mt7996_eeprom_load(struct mt7996_dev *dev)
    56 {
    57         int ret;
    58 
    59         ret = mt76_eeprom_init(&dev->mt76, MT7996_EEPROM_SIZE);
    60         if (ret < 0)
    61                 return ret;
    62 
    63         if (ret) {
    64                 dev->flash_mode = true;
    65         } else {
    66                 u8 free_block_num;
    67                 u32 block_num, i;
    68 
    69                 /* TODO: check free block event */
    70                 mt7996_mcu_get_eeprom_free_block(dev, &free_block_num);

free_block_num is not initialized if mt7996_mcu_get_eeprom_free_block()
fails.

    71                 /* efuse info not enough */
--> 72                 if (free_block_num >= 59)
    73                         return -EINVAL;
    74 
    75                 /* read eeprom data from efuse */
    76                 block_num = DIV_ROUND_UP(MT7996_EEPROM_SIZE, MT7996_EEPROM_BLOCK_SIZE);
    77                 for (i = 0; i < block_num; i++)
    78                         mt7996_mcu_get_eeprom(dev, i * MT7996_EEPROM_BLOCK_SIZE);
    79         }
    80 
    81         return mt7996_check_eeprom(dev);
    82 }

regards,
dan carpenter



More information about the Linux-mediatek mailing list