[bug report] mt76: mt7915: add support for MT7986
Dan Carpenter
dan.carpenter at oracle.com
Mon Feb 28 23:38:18 PST 2022
Hello Bo Jiao,
The patch 99ad32a4ca3a: "mt76: mt7915: add support for MT7986" from
Feb 9, 2022, leads to the following Smatch static checker warning:
drivers/net/wireless/mediatek/mt76/mt7915/soc.c:357 mt7986_wmac_adie_thermal_cal()
error: uninitialized symbol 'data'.
drivers/net/wireless/mediatek/mt76/mt7915/soc.c
349 static int mt7986_wmac_adie_thermal_cal(struct mt7915_dev *dev, u8 adie)
350 {
351 int ret;
352 u32 data, val;
353
354 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_THADC_ANALOG,
355 &data);
^^^^^
356 if (ret || FIELD_GET(MT_ADIE_ANA_EN_MASK, data)) {
--> 357 val = FIELD_GET(MT_ADIE_VRPI_SEL_EFUSE_MASK, data);
^^^^
If mt7986_wmac_adie_efuse_read() fails then data is uninitialized.
358 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC_BG,
359 MT_ADIE_VRPI_SEL_CR_MASK,
360 FIELD_PREP(MT_ADIE_VRPI_SEL_CR_MASK, val));
361 if (ret)
362 return ret;
363
364 val = FIELD_GET(MT_ADIE_PGA_GAIN_EFUSE_MASK, data);
365 ret = mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC,
366 MT_ADIE_PGA_GAIN_MASK,
367 FIELD_PREP(MT_ADIE_PGA_GAIN_MASK, val));
368 if (ret)
369 return ret;
370 }
371
372 ret = mt7986_wmac_adie_efuse_read(dev, adie, MT_ADIE_THADC_SLOP,
373 &data);
374 if (ret || FIELD_GET(MT_ADIE_ANA_EN_MASK, data)) {
375 val = FIELD_GET(MT_ADIE_LDO_CTRL_EFUSE_MASK, data);
Same
376
377 return mt76_wmac_spi_rmw(dev, adie, MT_ADIE_RG_TOP_THADC,
378 MT_ADIE_LDO_CTRL_MASK,
379 FIELD_PREP(MT_ADIE_LDO_CTRL_MASK, val));
380 }
381
382 return 0;
383 }
regards,
dan carpenter
More information about the Linux-mediatek
mailing list