[nbd168-wireless:mtk-flow-offload 9/9] drivers/net/wireless/mediatek/mt76/dma.c:145:17: warning: variable 'ring' set but not used

From: kernel test robot
Date: Mon Feb 14 2022 - 14:08:17 EST


tree: https://github.com/nbd168/wireless mtk-flow-offload
head: 6dbc6b1e07e9f4face597784cf4069cff9f3a043
commit: 6dbc6b1e07e9f4face597784cf4069cff9f3a043 [9/9] mt76: mt7915: add Wireless Ethernet Dispatch support
config: x86_64-randconfig-a005-20220214 (https://download.01.org/0day-ci/archive/20220215/202202150257.O7iGQocg-lkp@xxxxxxxxx/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project ea071884b0cc7210b3cc5fe858f0e892a779a23b)
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
# https://github.com/nbd168/wireless/commit/6dbc6b1e07e9f4face597784cf4069cff9f3a043
git remote add nbd168-wireless https://github.com/nbd168/wireless
git fetch --no-tags nbd168-wireless mtk-flow-offload
git checkout 6dbc6b1e07e9f4face597784cf4069cff9f3a043
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=x86_64 SHELL=/bin/bash drivers/net/wireless/mediatek/mt76/

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/dma.c:145:17: warning: variable 'ring' set but not used [-Wunused-but-set-variable]
int ret, type, ring;
^
>> drivers/net/wireless/mediatek/mt76/dma.c:165:7: warning: variable 'ret' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
case MT76_WED_Q_TXFREE:
^~~~~~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/dma.c:182:9: note: uninitialized use occurs here
return ret;
^~~
drivers/net/wireless/mediatek/mt76/dma.c:158:7: warning: variable 'ret' is used uninitialized whenever switch case is taken [-Wsometimes-uninitialized]
case MT76_WED_Q_TX:
^~~~~~~~~~~~~
drivers/net/wireless/mediatek/mt76/dma.c:182:9: note: uninitialized use occurs here
return ret;
^~~
drivers/net/wireless/mediatek/mt76/dma.c:145:9: note: initialize the variable 'ret' to silence this warning
int ret, type, ring;
^
= 0
3 warnings generated.


vim +/ring +145 drivers/net/wireless/mediatek/mt76/dma.c

140
141 static int
142 mt76_dma_wed_setup(struct mt76_dev *dev, struct mt76_queue *q)
143 {
144 struct mtk_wed_device *wed = &dev->mmio.wed;
> 145 int ret, type, ring;
146 u8 flags = q->flags;
147
148 if (!mtk_wed_device_active(wed))
149 q->flags &= ~MT_QFLAG_WED;
150
151 if (!(q->flags & MT_QFLAG_WED))
152 return 0;
153
154 type = FIELD_GET(MT_QFLAG_WED_TYPE, q->flags);
155 ring = FIELD_GET(MT_QFLAG_WED_RING, q->flags);
156
157 switch (type) {
158 case MT76_WED_Q_TX:
159 #ifdef CONFIG_NET_MEDIATEK_SOC_WED
160 ret = mtk_wed_device_tx_ring_setup(wed, ring, q->regs);
161 if (!ret)
162 q->wed_regs = wed->tx_ring[ring].reg_base;
163 #endif
164 break;
> 165 case MT76_WED_Q_TXFREE:
166 /* WED txfree queue needs ring to be initialized before setup */
167 q->flags = 0;
168 mt76_dma_queue_reset(dev, q);
169 mt76_dma_rx_fill(dev, q);
170 q->flags = flags;
171

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