diff mbox series

ath9k: use swap() to make code cleaner

Message ID a2400dd73f6ea8672bb6e50124cc3041c0c43d6d.1644838854.git.yang.guang5@zte.com.cn (mailing list archive)
State Changes Requested
Delegated to: Toke Høiland-Jørgensen
Headers show
Series ath9k: use swap() to make code cleaner | expand

Commit Message

David Yang Feb. 15, 2022, 12:52 a.m. UTC
From: Yang Guang <yang.guang5@zte.com.cn>

Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Signed-off-by: David Yang <davidcomponentone@gmail.com>
---
 drivers/net/wireless/ath/ath9k/calib.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Kalle Valo Feb. 15, 2022, 6:20 a.m. UTC | #1
davidcomponentone@gmail.com writes:

> From: Yang Guang <yang.guang5@zte.com.cn>
>
> Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
> opencoding it.

Liki Jiri mentioned in the ath5k patch, shouldn't you include that file?
diff mbox series

Patch

diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c
index 0422a33395b7..daf88330e13b 100644
--- a/drivers/net/wireless/ath/ath9k/calib.c
+++ b/drivers/net/wireless/ath/ath9k/calib.c
@@ -33,9 +33,7 @@  static int16_t ath9k_hw_get_nf_hist_mid(int16_t *nfCalBuffer)
 	for (i = 0; i < ATH9K_NF_CAL_HIST_MAX - 1; i++) {
 		for (j = 1; j < ATH9K_NF_CAL_HIST_MAX - i; j++) {
 			if (sort[j] > sort[j - 1]) {
-				nfval = sort[j];
-				sort[j] = sort[j - 1];
-				sort[j - 1] = nfval;
+				swap(sort[j], sort[j - 1]);
 			}
 		}
 	}