Re: [PATCH net-next] net/mlx4: Remove redundant ternary operators

From: Zhu Yanjun
Date: Wed Aug 27 2025 - 22:47:27 EST


在 2025/8/27 5:15, Liao Yuanhong 写道:
For ternary operators in the form of "a ? true : false", if 'a' itself
returns a boolean result, the ternary operator can be omitted. Remove
redundant ternary operators to clean up the code.

Signed-off-by: Liao Yuanhong <liaoyuanhong@xxxxxxxx>
---
drivers/net/ethernet/mellanox/mlx4/port.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/mellanox/mlx4/port.c b/drivers/net/ethernet/mellanox/mlx4/port.c
index e3d0b13c1610..5abdb1363ccc 100644
--- a/drivers/net/ethernet/mellanox/mlx4/port.c
+++ b/drivers/net/ethernet/mellanox/mlx4/port.c
@@ -156,7 +156,7 @@ static bool mlx4_need_mf_bond(struct mlx4_dev *dev)
mlx4_foreach_port(i, dev, MLX4_PORT_TYPE_ETH)
++num_eth_ports;
- return (num_eth_ports == 2) ? true : false;
+ return num_eth_ports == 2;

Reviewed-by: Zhu Yanjun <yanjun.zhu@xxxxxxxxx>

Zhu Yanjun

}
int __mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac)