[linux-next:master 432/3001] drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:6699:30-31: WARNING opportunity for swap() (fwd)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




---------- Forwarded message ----------
Date: Thu, 1 Feb 2024 01:09:37 +0800
From: kernel test robot <lkp@xxxxxxxxx>
To: oe-kbuild@xxxxxxxxxxxxxxx
Cc: lkp@xxxxxxxxx, Julia Lawall <julia.lawall@xxxxxxxx>
Subject: [linux-next:master 432/3001]
    drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:6699:30-31: WARNING
    opportunity for swap()

BCC: lkp@xxxxxxxxx
CC: oe-kbuild-all@xxxxxxxxxxxxxxx
CC: Linux Memory Management List <linux-mm@xxxxxxxxx>
TO: Martin Kaistra <martin.kaistra@xxxxxxxxxxxxx>
CC: Kalle Valo <kvalo@xxxxxxxxxx>
CC: "Ping-Ke Shih" <pkshih@xxxxxxxxxxx>

tree:   https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master
head:   06f658aadff0e483ee4f807b0b46c9e5cba62bfa
commit: 69abad618efd17e50bc6f880332ab36b660b0b34 [432/3001] wifi: rtl8xxxu: make supporting AP mode only on port 0 transparent
:::::: branch date: 15 hours ago
:::::: commit date: 3 weeks ago
config: arm-randconfig-r054-20240131 (https://download.01.org/0day-ci/archive/20240201/202402010039.1v5WRSXr-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 13.2.0

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Reported-by: Julia Lawall <julia.lawall@xxxxxxxx>
| Closes: https://lore.kernel.org/r/202402010039.1v5WRSXr-lkp@xxxxxxxxx/

cocci warnings: (new ones prefixed by >>)
>> drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c:6699:30-31: WARNING opportunity for swap()

vim +6699 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c

26f1fad29ad973 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu.c      Jes Sorensen   2015-10-14  6626
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6627  static void rtl8xxxu_switch_ports(struct rtl8xxxu_priv *priv)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6628  {
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6629  	u8 macid[ETH_ALEN], bssid[ETH_ALEN], macid_1[ETH_ALEN], bssid_1[ETH_ALEN];
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6630  	u8 msr, bcn_ctrl, bcn_ctrl_1, atimwnd[2], atimwnd_1[2];
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6631  	struct rtl8xxxu_vif *rtlvif;
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6632  	struct ieee80211_vif *vif;
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6633  	u8 tsftr[8], tsftr_1[8];
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6634  	int i;
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6635
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6636  	msr = rtl8xxxu_read8(priv, REG_MSR);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6637  	bcn_ctrl = rtl8xxxu_read8(priv, REG_BEACON_CTRL);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6638  	bcn_ctrl_1 = rtl8xxxu_read8(priv, REG_BEACON_CTRL_1);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6639
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6640  	for (i = 0; i < ARRAY_SIZE(atimwnd); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6641  		atimwnd[i] = rtl8xxxu_read8(priv, REG_ATIMWND + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6642  	for (i = 0; i < ARRAY_SIZE(atimwnd_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6643  		atimwnd_1[i] = rtl8xxxu_read8(priv, REG_ATIMWND_1 + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6644
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6645  	for (i = 0; i < ARRAY_SIZE(tsftr); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6646  		tsftr[i] = rtl8xxxu_read8(priv, REG_TSFTR + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6647  	for (i = 0; i < ARRAY_SIZE(tsftr); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6648  		tsftr_1[i] = rtl8xxxu_read8(priv, REG_TSFTR1 + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6649
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6650  	for (i = 0; i < ARRAY_SIZE(macid); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6651  		macid[i] = rtl8xxxu_read8(priv, REG_MACID + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6652
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6653  	for (i = 0; i < ARRAY_SIZE(bssid); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6654  		bssid[i] = rtl8xxxu_read8(priv, REG_BSSID + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6655
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6656  	for (i = 0; i < ARRAY_SIZE(macid_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6657  		macid_1[i] = rtl8xxxu_read8(priv, REG_MACID1 + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6658
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6659  	for (i = 0; i < ARRAY_SIZE(bssid_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6660  		bssid_1[i] = rtl8xxxu_read8(priv, REG_BSSID1 + i);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6661
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6662  	/* disable bcn function, disable update TSF */
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6663  	rtl8xxxu_write8(priv, REG_BEACON_CTRL, (bcn_ctrl &
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6664  			(~BEACON_FUNCTION_ENABLE)) | BEACON_DISABLE_TSF_UPDATE);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6665  	rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, (bcn_ctrl_1 &
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6666  			(~BEACON_FUNCTION_ENABLE)) | BEACON_DISABLE_TSF_UPDATE);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6667
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6668  	/* switch msr */
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6669  	msr = (msr & 0xf0) | ((msr & 0x03) << 2) | ((msr & 0x0c) >> 2);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6670  	rtl8xxxu_write8(priv, REG_MSR, msr);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6671
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6672  	/* write port0 */
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6673  	rtl8xxxu_write8(priv, REG_BEACON_CTRL, bcn_ctrl_1 & ~BEACON_FUNCTION_ENABLE);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6674  	for (i = 0; i < ARRAY_SIZE(atimwnd_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6675  		rtl8xxxu_write8(priv, REG_ATIMWND + i, atimwnd_1[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6676  	for (i = 0; i < ARRAY_SIZE(tsftr_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6677  		rtl8xxxu_write8(priv, REG_TSFTR + i, tsftr_1[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6678  	for (i = 0; i < ARRAY_SIZE(macid_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6679  		rtl8xxxu_write8(priv, REG_MACID + i, macid_1[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6680  	for (i = 0; i < ARRAY_SIZE(bssid_1); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6681  		rtl8xxxu_write8(priv, REG_BSSID + i, bssid_1[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6682
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6683  	/* write port1 */
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6684  	rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, bcn_ctrl & ~BEACON_FUNCTION_ENABLE);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6685  	for (i = 0; i < ARRAY_SIZE(atimwnd); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6686  		rtl8xxxu_write8(priv, REG_ATIMWND_1 + i, atimwnd[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6687  	for (i = 0; i < ARRAY_SIZE(tsftr); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6688  		rtl8xxxu_write8(priv, REG_TSFTR1 + i, tsftr[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6689  	for (i = 0; i < ARRAY_SIZE(macid); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6690  		rtl8xxxu_write8(priv, REG_MACID1 + i, macid[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6691  	for (i = 0; i < ARRAY_SIZE(bssid); i++)
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6692  		rtl8xxxu_write8(priv, REG_BSSID1 + i, bssid[i]);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6693
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6694  	/* write bcn ctl */
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6695  	rtl8xxxu_write8(priv, REG_BEACON_CTRL, bcn_ctrl_1);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6696  	rtl8xxxu_write8(priv, REG_BEACON_CTRL_1, bcn_ctrl);
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6697
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6698  	vif = priv->vifs[0];
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22 @6699  	priv->vifs[0] = priv->vifs[1];
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6700  	priv->vifs[1] = vif;
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6701
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6702  	/* priv->vifs[0] is NULL here, based on how this function is currently
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6703  	 * called from rtl8xxxu_add_interface().
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6704  	 * When this function will be used in the future for a different
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6705  	 * scenario, please check whether vifs[0] or vifs[1] can be NULL and if
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6706  	 * necessary add code to set port_num = 1.
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6707  	 */
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6708  	rtlvif = (struct rtl8xxxu_vif *)priv->vifs[1]->drv_priv;
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6709  	rtlvif->port_num = 1;
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6710  }
69abad618efd17 drivers/net/wireless/realtek/rtl8xxxu/rtl8xxxu_core.c Martin Kaistra 2023-12-22  6711

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux