From: Thorsten Blum Date: Wed, 10 Jul 2024 18:57:44 +0000 (+0200) Subject: wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid() X-Git-Tag: v6.12-rc1~232^2~101^2~69^2~9 X-Git-Url: https://git.kernel.dk/?a=commitdiff_plain;h=215a19631d1125a2834b2ffe62b8de9a9e73d6a8;p=linux-block.git wifi: ath9k: Use swap() to improve ath9k_hw_get_nf_hist_mid() Use the swap() macro to simplify the ath9k_hw_get_nf_hist_mid() function and improve its readability. Fixes the following Coccinelle/coccicheck warning reported by swap.cocci: WARNING opportunity for swap() Compile-tested only. Signed-off-by: Thorsten Blum Acked-by: Toke Høiland-Jørgensen Signed-off-by: Kalle Valo Link: https://patch.msgid.link/20240710185743.709742-2-thorsten.blum@toblux.com --- diff --git a/drivers/net/wireless/ath/ath9k/calib.c b/drivers/net/wireless/ath/ath9k/calib.c index fb270df75eb2..4b331c85509c 100644 --- a/drivers/net/wireless/ath/ath9k/calib.c +++ b/drivers/net/wireless/ath/ath9k/calib.c @@ -32,11 +32,8 @@ 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; - } + if (sort[j] > sort[j - 1]) + swap(sort[j], sort[j - 1]); } } nfval = sort[(ATH9K_NF_CAL_HIST_MAX - 1) >> 1];