ath5k: replace ternary operator with min()
authorGuo Zhengkui <guozhengkui@vivo.com>
Tue, 17 May 2022 02:39:23 +0000 (10:39 +0800)
committerKalle Valo <quic_kvalo@quicinc.com>
Sun, 22 May 2022 12:29:42 +0000 (15:29 +0300)
Fix the following coccicheck warning:

drivers/net/wireless/ath/ath5k/phy.c:3139:62-63: WARNING
opportunity for min()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>
Link: https://lore.kernel.org/r/20220517023923.76989-1-guozhengkui@vivo.com
drivers/net/wireless/ath/ath5k/phy.c

index 00f9e347d414dcd79eb74bcd0033c1583222878a..5797ef9c73d725e9250089557fa6890a45b70643 100644 (file)
@@ -3136,7 +3136,7 @@ ath5k_combine_pwr_to_pdadc_curves(struct ath5k_hw *ah,
                pdadc_n = gain_boundaries[pdg] + pd_gain_overlap - pwr_min[pdg];
                /* Limit it to be inside pwr range */
                table_size = pwr_max[pdg] - pwr_min[pdg];
-               max_idx = (pdadc_n < table_size) ? pdadc_n : table_size;
+               max_idx = min(pdadc_n, table_size);
 
                /* Fill pdadc_out table */
                while (pdadc_0 < max_idx && pdadc_i < 128)