[PATCH linux-next v2] net: ath5k: replace ternary operator with min()

Guo Zhengkui posted 1 patch 3 years, 11 months ago
drivers/net/wireless/ath/ath5k/phy.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH linux-next v2] net: ath5k: replace ternary operator with min()
Posted by Guo Zhengkui 3 years, 11 months ago
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>
---
 drivers/net/wireless/ath/ath5k/phy.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath5k/phy.c b/drivers/net/wireless/ath/ath5k/phy.c
index 00f9e347d414..5797ef9c73d7 100644
--- a/drivers/net/wireless/ath/ath5k/phy.c
+++ b/drivers/net/wireless/ath/ath5k/phy.c
@@ -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)
-- 
2.20.1
Re: [PATCH linux-next v2] net: ath5k: replace ternary operator with min()
Posted by Kalle Valo 3 years, 11 months ago
Guo Zhengkui <guozhengkui@vivo.com> wrote:

> 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>

Patch applied to ath-next branch of ath.git, thanks.

b380d2056ebb ath5k: replace ternary operator with min()

-- 
https://patchwork.kernel.org/project/linux-wireless/patch/20220517023923.76989-1-guozhengkui@vivo.com/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches