drivers/net/wireless/mediatek/mt76/mt7615/testmode.c:83:7: warning: variable 'index' set but not used

From: kernel test robot
Date: Sun Aug 16 2020 - 09:54:03 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 4b6c093e21d36bede0fd88fd0aeb3b03647260e4
commit: 4f0bce1c8888245e006f8c88f44b7419b47a1b4b mt76: mt7615: implement testmode support
date: 4 weeks ago
config: microblaze-randconfig-r006-20200816 (attached as .config)
compiler: microblaze-linux-gcc (GCC) 9.3.0
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
git checkout 4f0bce1c8888245e006f8c88f44b7419b47a1b4b
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=microblaze

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/mt7615/testmode.c: In function 'mt7615_tm_set_tx_power':
>> drivers/net/wireless/mediatek/mt76/mt7615/testmode.c:83:7: warning: variable 'index' set but not used [-Wunused-but-set-variable]
83 | int index;
| ^~~~~

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=4f0bce1c8888245e006f8c88f44b7419b47a1b4b
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 4f0bce1c8888245e006f8c88f44b7419b47a1b4b
vim +/index +83 drivers/net/wireless/mediatek/mt76/mt7615/testmode.c

46
47 static int
48 mt7615_tm_set_tx_power(struct mt7615_phy *phy)
49 {
50 struct mt7615_dev *dev = phy->dev;
51 struct mt76_phy *mphy = phy->mt76;
52 int i, ret, n_chains = hweight8(mphy->antenna_mask);
53 struct cfg80211_chan_def *chandef = &mphy->chandef;
54 int freq = chandef->center_freq1, len, target_chains;
55 u8 *data, *eep = (u8 *)dev->mt76.eeprom.data;
56 enum nl80211_band band = chandef->chan->band;
57 struct sk_buff *skb;
58 struct {
59 u8 center_chan;
60 u8 dbdc_idx;
61 u8 band;
62 u8 rsv;
63 } __packed req_hdr = {
64 .center_chan = ieee80211_frequency_to_channel(freq),
65 .band = band,
66 .dbdc_idx = phy != &dev->phy,
67 };
68 u8 *tx_power = NULL;
69
70 if (dev->mt76.test.state != MT76_TM_STATE_OFF)
71 tx_power = dev->mt76.test.tx_power;
72
73 len = sizeof(req_hdr) + MT7615_EE_MAX - MT_EE_NIC_CONF_0;
74 skb = mt76_mcu_msg_alloc(&dev->mt76, NULL, sizeof(req_hdr) + len);
75 if (!skb)
76 return -ENOMEM;
77
78 skb_put_data(skb, &req_hdr, sizeof(req_hdr));
79 data = skb_put_data(skb, eep + MT_EE_NIC_CONF_0, len);
80
81 target_chains = mt7615_ext_pa_enabled(dev, band) ? 1 : n_chains;
82 for (i = 0; i < target_chains; i++) {
> 83 int index;
84
85 ret = mt7615_eeprom_get_target_power_index(dev, chandef->chan, i);
86 if (ret < 0)
87 return -EINVAL;
88
89 index = ret - MT_EE_NIC_CONF_0;
90 if (tx_power && tx_power[i])
91 data[ret - MT_EE_NIC_CONF_0] = tx_power[i];
92 }
93
94 return __mt76_mcu_skb_send_msg(&dev->mt76, skb,
95 MCU_EXT_CMD_SET_TX_POWER_CTRL, false);
96 }
97

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

Attachment: .config.gz
Description: application/gzip