mt76: mt7615: wake device before accessing regmap in debugfs
Hello Lorenzo Bianconi,
The patch ea4906c4be49: "mt76: mt7615: wake device before accessing regmap in debugfs" from Jul 3, 2020, leads to the following static checker warning:
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:179 mt7615_reset_test_set() warn: inconsistent returns 'dev->mt76.mutex'.
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c
159 static int
160 mt7615_reset_test_set(void *data, u64 val)
161 {
162 struct mt7615_dev *dev = data;
163 struct sk_buff *skb;
164
165 if (!mt7615_wait_for_mcu_init(dev))
166 return 0;
167
168 mt7615_mutex_acquire(dev);
169
170 skb = alloc_skb(1, GFP_KERNEL);
171 if (!skb)
172 return -ENOMEM;
^^^^^^^^^^^^^^This is returning with the mutex held. What is the mutex protecting? We could move the allocation and the skb_put() before the mt7615_mutex_acquire().
173 174 skb_put(skb, 1); 175 mt76_tx_queue_skb_raw(dev, 0, skb, 0); 176 177 mt7615_mutex_release(dev); 178 179 return 0; 180 }
regards,
dan carpenter
Quoted 6 lines
Hello Lorenzo Bianconi,
The patch
ea4906c4be49: "mt76: mt7615: wake device before accessing regmap in debugfs" from Jul 3, 2020, leads to the following static checker warning:
Hi Dan,
thx for the report. I will post a fix soon.
Regards,
Lorenzo
Quoted 35 lines
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c:179 mt7615_reset_test_set() warn: inconsistent returns 'dev->mt76.mutex'.
drivers/net/wireless/mediatek/mt76/mt7615/debugfs.c159 static int 160 mt7615_reset_test_set(void *data, u64 val) 161 { 162 struct mt7615_dev *dev = data; 163 struct sk_buff *skb; 164 165 if (!mt7615_wait_for_mcu_init(dev)) 166 return 0; 167 168 mt7615_mutex_acquire(dev); 169 170 skb = alloc_skb(1, GFP_KERNEL); 171 if (!skb) 172 return -ENOMEM; ^^^^^^^^^^^^^^This is returning with the mutex held. What is the mutex protecting? We could move the allocation and the
skb_put()before themt7615_mutex_acquire().173 174 skb_put(skb, 1); 175 mt76_tx_queue_skb_raw(dev, 0, skb, 0); 176 177 mt7615_mutex_release(dev); 178 179 return 0; 180 }regards,
dan carpenter
Signature · 3 lines
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch; unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp; umount; make clean; sleep