linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number
@ 2020-06-11 10:46 Dan Carpenter
  0 siblings, 0 replies; 2+ messages in thread
From: Dan Carpenter @ 2020-06-11 10:46 UTC (permalink / raw)
  To: kbuild, Ryder Lee
  Cc: lkp, kbuild-all, linux-kernel, Felix Fietkau, Shayne Chen, Chih-Min Chen

[-- Attachment #1: Type: text/plain, Size: 3857 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   b29482fde649c72441d5478a4ea2c52c56d97a5e
commit: e57b7901469fc0b021930b83a8094baaf3d81b09 mt76: add mac80211 driver for MT7915 PCIe-based chipsets
config: x86_64-randconfig-m031-20200611 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number

# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=e57b7901469fc0b021930b83a8094baaf3d81b09
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git remote update linus
git checkout e57b7901469fc0b021930b83a8094baaf3d81b09
vim +1130 drivers/net/wireless/mediatek/mt76/mt7915/mac.c

e57b7901469fc0 Ryder Lee 2020-04-25  1108  void mt7915_mac_sta_stats_work(struct work_struct *work)
e57b7901469fc0 Ryder Lee 2020-04-25  1109  {
e57b7901469fc0 Ryder Lee 2020-04-25  1110  	struct ieee80211_sta *sta;
e57b7901469fc0 Ryder Lee 2020-04-25  1111  	struct ieee80211_vif *vif;
e57b7901469fc0 Ryder Lee 2020-04-25  1112  	struct mt7915_sta_stats *stats;
e57b7901469fc0 Ryder Lee 2020-04-25  1113  	struct mt7915_sta *msta;
e57b7901469fc0 Ryder Lee 2020-04-25  1114  	struct mt7915_dev *dev;
e57b7901469fc0 Ryder Lee 2020-04-25  1115  
e57b7901469fc0 Ryder Lee 2020-04-25  1116  	msta = container_of(work, struct mt7915_sta, stats_work);
e57b7901469fc0 Ryder Lee 2020-04-25  1117  	sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
e57b7901469fc0 Ryder Lee 2020-04-25  1118  	vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv);
e57b7901469fc0 Ryder Lee 2020-04-25  1119  	dev = msta->vif->dev;
e57b7901469fc0 Ryder Lee 2020-04-25  1120  	stats = &msta->stats;
e57b7901469fc0 Ryder Lee 2020-04-25  1121  
e57b7901469fc0 Ryder Lee 2020-04-25  1122  	/* use MT_TX_FREE_RATE to report Tx rate for further devices */
e57b7901469fc0 Ryder Lee 2020-04-25  1123  	if (time_after(jiffies, stats->jiffies + HZ)) {
e57b7901469fc0 Ryder Lee 2020-04-25  1124  		mt7915_mcu_get_rate_info(dev, RATE_CTRL_RU_INFO,
e57b7901469fc0 Ryder Lee 2020-04-25  1125  					 msta->wcid.idx);
e57b7901469fc0 Ryder Lee 2020-04-25  1126  
e57b7901469fc0 Ryder Lee 2020-04-25  1127  		stats->jiffies = jiffies;
e57b7901469fc0 Ryder Lee 2020-04-25  1128  	}
e57b7901469fc0 Ryder Lee 2020-04-25  1129  
e57b7901469fc0 Ryder Lee 2020-04-25 @1130  	if (test_and_clear_bit(IEEE80211_RC_SUPP_RATES_CHANGED |
e57b7901469fc0 Ryder Lee 2020-04-25  1131  			       IEEE80211_RC_NSS_CHANGED |
e57b7901469fc0 Ryder Lee 2020-04-25  1132  			       IEEE80211_RC_BW_CHANGED, &stats->changed))

The test_and_clear_bit() takes a bit number like 1.  But this is
passing "(1 << 1) | ...".  It won't work at all.

e57b7901469fc0 Ryder Lee 2020-04-25  1133  		mt7915_mcu_add_rate_ctrl(dev, vif, sta);
e57b7901469fc0 Ryder Lee 2020-04-25  1134  
e57b7901469fc0 Ryder Lee 2020-04-25  1135  	if (test_and_clear_bit(IEEE80211_RC_SMPS_CHANGED, &stats->changed))
e57b7901469fc0 Ryder Lee 2020-04-25  1136  		mt7915_mcu_add_smps(dev, vif, sta);
e57b7901469fc0 Ryder Lee 2020-04-25  1137  
e57b7901469fc0 Ryder Lee 2020-04-25  1138  	spin_lock_bh(&dev->sta_poll_lock);
e57b7901469fc0 Ryder Lee 2020-04-25  1139  	if (list_empty(&msta->poll_list))
e57b7901469fc0 Ryder Lee 2020-04-25  1140  		list_add_tail(&msta->poll_list, &dev->sta_poll_list);
e57b7901469fc0 Ryder Lee 2020-04-25  1141  	spin_unlock_bh(&dev->sta_poll_lock);
e57b7901469fc0 Ryder Lee 2020-04-25  1142  }

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 37195 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

* drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number
@ 2020-08-12  5:51 kernel test robot
  0 siblings, 0 replies; 2+ messages in thread
From: kernel test robot @ 2020-08-12  5:51 UTC (permalink / raw)
  To: Ryder Lee
  Cc: kbuild-all, linux-kernel, Felix Fietkau, Shayne Chen, Chih-Min Chen

[-- Attachment #1: Type: text/plain, Size: 2170 bytes --]

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head:   fb893de323e2d39f7a1f6df425703a2edbdf56ea
commit: e57b7901469fc0b021930b83a8094baaf3d81b09 mt76: add mac80211 driver for MT7915 PCIe-based chipsets
date:   3 months ago
config: parisc-randconfig-m031-20200811 (attached as .config)
compiler: hppa-linux-gcc (GCC) 9.3.0

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

smatch warnings:
drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number

vim +1130 drivers/net/wireless/mediatek/mt76/mt7915/mac.c

  1107	
  1108	void mt7915_mac_sta_stats_work(struct work_struct *work)
  1109	{
  1110		struct ieee80211_sta *sta;
  1111		struct ieee80211_vif *vif;
  1112		struct mt7915_sta_stats *stats;
  1113		struct mt7915_sta *msta;
  1114		struct mt7915_dev *dev;
  1115	
  1116		msta = container_of(work, struct mt7915_sta, stats_work);
  1117		sta = container_of((void *)msta, struct ieee80211_sta, drv_priv);
  1118		vif = container_of((void *)msta->vif, struct ieee80211_vif, drv_priv);
  1119		dev = msta->vif->dev;
  1120		stats = &msta->stats;
  1121	
  1122		/* use MT_TX_FREE_RATE to report Tx rate for further devices */
  1123		if (time_after(jiffies, stats->jiffies + HZ)) {
  1124			mt7915_mcu_get_rate_info(dev, RATE_CTRL_RU_INFO,
  1125						 msta->wcid.idx);
  1126	
  1127			stats->jiffies = jiffies;
  1128		}
  1129	
> 1130		if (test_and_clear_bit(IEEE80211_RC_SUPP_RATES_CHANGED |
  1131				       IEEE80211_RC_NSS_CHANGED |
  1132				       IEEE80211_RC_BW_CHANGED, &stats->changed))
  1133			mt7915_mcu_add_rate_ctrl(dev, vif, sta);
  1134	
  1135		if (test_and_clear_bit(IEEE80211_RC_SMPS_CHANGED, &stats->changed))
  1136			mt7915_mcu_add_smps(dev, vif, sta);
  1137	
  1138		spin_lock_bh(&dev->sta_poll_lock);
  1139		if (list_empty(&msta->poll_list))
  1140			list_add_tail(&msta->poll_list, &dev->sta_poll_list);
  1141		spin_unlock_bh(&dev->sta_poll_lock);
  1142	}
  1143	

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 30542 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-08-12  5:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-11 10:46 drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number Dan Carpenter
2020-08-12  5:51 kernel test robot

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).