[PATCH linux-next v2] net: ath9k: replace ternary operator with max()

Guo Zhengkui posted 1 patch 3 years, 11 months ago
drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
[PATCH linux-next v2] net: ath9k: replace ternary operator with max()
Posted by Guo Zhengkui 3 years, 11 months ago
Fix the following coccicheck warning:

drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
opportunity for max()

Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
---
 drivers/net/wireless/ath/ath9k/dfs.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/wireless/ath/ath9k/dfs.c b/drivers/net/wireless/ath/ath9k/dfs.c
index acb9602aa464..11349218bc21 100644
--- a/drivers/net/wireless/ath/ath9k/dfs.c
+++ b/drivers/net/wireless/ath/ath9k/dfs.c
@@ -246,7 +246,7 @@ ath9k_postprocess_radar_event(struct ath_softc *sc,
 		DFS_STAT_INC(sc, dc_phy_errors);
 
 		/* when both are present use stronger one */
-		rssi = (ard->rssi < ard->ext_rssi) ? ard->ext_rssi : ard->rssi;
+		rssi = max(ard->rssi, ard->ext_rssi);
 		break;
 	default:
 		/*
-- 
2.20.1
Re: [PATCH linux-next v2] net: ath9k: replace ternary operator with max()
Posted by Kalle Valo 3 years, 11 months ago
Guo Zhengkui <guozhengkui@vivo.com> wrote:

> Fix the following coccicheck warning:
> 
> drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
> opportunity for max()
> 
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>
> Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>
> Signed-off-by: Kalle Valo <quic_kvalo@quicinc.com>

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

2be8afe05833 ath9k: replace ternary operator with max()

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

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

Re: [PATCH linux-next v2] net: ath9k: replace ternary operator with max()
Posted by Toke Høiland-Jørgensen 3 years, 11 months ago
Guo Zhengkui <guozhengkui@vivo.com> writes:

> Fix the following coccicheck warning:
>
> drivers/net/wireless/ath/ath9k/dfs.c:249:28-30: WARNING
> opportunity for max()
>
> Signed-off-by: Guo Zhengkui <guozhengkui@vivo.com>

Acked-by: Toke Høiland-Jørgensen <toke@toke.dk>