public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: kbuild@lists.01.org, Ryder Lee <ryder.lee@mediatek.com>
Cc: lkp@intel.com, kbuild-all@lists.01.org,
	linux-kernel@vger.kernel.org, Felix Fietkau <nbd@nbd.name>,
	Shayne Chen <shayne.chen@mediatek.com>,
	Chih-Min Chen <chih-min.chen@mediatek.com>
Subject: drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number
Date: Thu, 11 Jun 2020 13:46:40 +0300	[thread overview]
Message-ID: <20200611104640.GF4151@kadam> (raw)

[-- 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 --]

             reply	other threads:[~2020-06-11 10:47 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 10:46 Dan Carpenter [this message]
  -- strict thread matches above, loose matches on Subject: below --
2020-08-12  5:51 drivers/net/wireless/mediatek/mt76/mt7915/mac.c:1130 mt7915_mac_sta_stats_work() warn: test_bit() takes a bit number kernel test robot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200611104640.GF4151@kadam \
    --to=dan.carpenter@oracle.com \
    --cc=chih-min.chen@mediatek.com \
    --cc=kbuild-all@lists.01.org \
    --cc=kbuild@lists.01.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lkp@intel.com \
    --cc=nbd@nbd.name \
    --cc=ryder.lee@mediatek.com \
    --cc=shayne.chen@mediatek.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox