diff mbox series

[v2] wifi: rtw89: chan: Use swap() in rtw89_swap_sub_entity()

Message ID 20240529020244.129027-1-jiapeng.chong@linux.alibaba.com (mailing list archive)
State Accepted
Delegated to: Ping-Ke Shih
Headers show
Series [v2] wifi: rtw89: chan: Use swap() in rtw89_swap_sub_entity() | expand

Commit Message

Jiapeng Chong May 29, 2024, 2:02 a.m. UTC
Use existing swap() function instead of keeping duplicate source code.

./drivers/net/wireless/realtek/rtw89/chan.c:2336:32-33: WARNING opportunity for swap().

Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9174
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
Changes in v2:
  -Amend commit message to make it more clearer.

 drivers/net/wireless/realtek/rtw89/chan.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

Comments

Ping-Ke Shih June 3, 2024, 1:46 a.m. UTC | #1
Jiapeng Chong <jiapeng.chong@linux.alibaba.com> wrote:

> Use existing swap() function instead of keeping duplicate source code.
> 
> ./drivers/net/wireless/realtek/rtw89/chan.c:2336:32-33: WARNING opportunity for swap().
> 
> Reported-by: Abaci Robot <abaci@linux.alibaba.com>
> Closes: https://bugzilla.openanolis.cn/show_bug.cgi?id=9174
> Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

9373ed280651 wifi: rtw89: chan: Use swap() in rtw89_swap_sub_entity()

---
https://github.com/pkshih/rtw.git
diff mbox series

Patch

diff --git a/drivers/net/wireless/realtek/rtw89/chan.c b/drivers/net/wireless/realtek/rtw89/chan.c
index 051a3cad6101..3b1997223cc5 100644
--- a/drivers/net/wireless/realtek/rtw89/chan.c
+++ b/drivers/net/wireless/realtek/rtw89/chan.c
@@ -2322,7 +2322,6 @@  static void rtw89_swap_sub_entity(struct rtw89_dev *rtwdev,
 				  enum rtw89_sub_entity_idx idx2)
 {
 	struct rtw89_hal *hal = &rtwdev->hal;
-	struct rtw89_sub_entity tmp;
 	struct rtw89_vif *rtwvif;
 	u8 cur;
 
@@ -2332,9 +2331,7 @@  static void rtw89_swap_sub_entity(struct rtw89_dev *rtwdev,
 	hal->sub[idx1].cfg->idx = idx2;
 	hal->sub[idx2].cfg->idx = idx1;
 
-	tmp = hal->sub[idx1];
-	hal->sub[idx1] = hal->sub[idx2];
-	hal->sub[idx2] = tmp;
+	swap(hal->sub[idx1], hal->sub[idx2]);
 
 	rtw89_for_each_rtwvif(rtwdev, rtwvif) {
 		if (!rtwvif->chanctx_assigned)