drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:520:3: warning: variable 'stats' is uninitialized when used here

From: kernel test robot
Date: Sun Feb 21 2021 - 16:21:00 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 55f62bc873477dae2c45bbbc30b86cf3e0982f3b
commit: 5c14a5f944b91371961548b1907802f74a4d2e5c mt76: mt7921: introduce mt7921e support
date: 3 weeks ago
config: powerpc-randconfig-r025-20210222 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project c9439ca36342fb6013187d0a69aef92736951476)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install powerpc cross compiling tool for clang build
# apt-get install binutils-powerpc-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5c14a5f944b91371961548b1907802f74a4d2e5c
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 5c14a5f944b91371961548b1907802f74a4d2e5c
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=powerpc

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

>> drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:520:3: warning: variable 'stats' is uninitialized when used here [-Wuninitialized]
stats->tx_rate = rate;
^~~~~
drivers/net/wireless/mediatek/mt76/mt7921/mcu.c:512:32: note: initialize the variable 'stats' to silence this warning
struct mt7921_sta_stats *stats;
^
= NULL
1 warning generated.


vim +/stats +520 drivers/net/wireless/mediatek/mt76/mt7921/mcu.c

1c099ab44727c8 Sean Wang 2021-01-28 500
1c099ab44727c8 Sean Wang 2021-01-28 501 static void
1c099ab44727c8 Sean Wang 2021-01-28 502 mt7921_mcu_tx_rate_report(struct mt7921_dev *dev, struct sk_buff *skb,
1c099ab44727c8 Sean Wang 2021-01-28 503 u16 wlan_idx)
1c099ab44727c8 Sean Wang 2021-01-28 504 {
1c099ab44727c8 Sean Wang 2021-01-28 505 struct mt7921_mcu_wlan_info_event *wtbl_info =
1c099ab44727c8 Sean Wang 2021-01-28 506 (struct mt7921_mcu_wlan_info_event *)(skb->data);
1c099ab44727c8 Sean Wang 2021-01-28 507 struct rate_info rate = {};
1c099ab44727c8 Sean Wang 2021-01-28 508 u8 curr_idx = wtbl_info->rate_info.rate_idx;
1c099ab44727c8 Sean Wang 2021-01-28 509 u16 curr = le16_to_cpu(wtbl_info->rate_info.rate[curr_idx]);
1c099ab44727c8 Sean Wang 2021-01-28 510 struct mt7921_mcu_peer_cap peer = wtbl_info->peer_cap;
1c099ab44727c8 Sean Wang 2021-01-28 511 struct mt76_phy *mphy = &dev->mphy;
1c099ab44727c8 Sean Wang 2021-01-28 512 struct mt7921_sta_stats *stats;
1c099ab44727c8 Sean Wang 2021-01-28 513 struct mt7921_sta *msta;
1c099ab44727c8 Sean Wang 2021-01-28 514 struct mt76_wcid *wcid;
1c099ab44727c8 Sean Wang 2021-01-28 515
1c099ab44727c8 Sean Wang 2021-01-28 516 if (wlan_idx >= MT76_N_WCIDS)
1c099ab44727c8 Sean Wang 2021-01-28 517 return;
1c099ab44727c8 Sean Wang 2021-01-28 518 wcid = rcu_dereference(dev->mt76.wcid[wlan_idx]);
1c099ab44727c8 Sean Wang 2021-01-28 519 if (!wcid) {
1c099ab44727c8 Sean Wang 2021-01-28 @520 stats->tx_rate = rate;
1c099ab44727c8 Sean Wang 2021-01-28 521 return;
1c099ab44727c8 Sean Wang 2021-01-28 522 }
1c099ab44727c8 Sean Wang 2021-01-28 523
1c099ab44727c8 Sean Wang 2021-01-28 524 msta = container_of(wcid, struct mt7921_sta, wcid);
1c099ab44727c8 Sean Wang 2021-01-28 525 stats = &msta->stats;
1c099ab44727c8 Sean Wang 2021-01-28 526
1c099ab44727c8 Sean Wang 2021-01-28 527 /* current rate */
1c099ab44727c8 Sean Wang 2021-01-28 528 mt7921_mcu_tx_rate_parse(mphy, &peer, &rate, curr);
1c099ab44727c8 Sean Wang 2021-01-28 529 stats->tx_rate = rate;
1c099ab44727c8 Sean Wang 2021-01-28 530 }
1c099ab44727c8 Sean Wang 2021-01-28 531

:::::: The code at line 520 was first introduced by commit
:::::: 1c099ab44727c8e42fe4de4d91b53cec3ef02860 mt76: mt7921: add MCU support

:::::: TO: Sean Wang <sean.wang@xxxxxxxxxxxx>
:::::: CC: Felix Fietkau <nbd@xxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip