lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5b197403-4f7c-4d59-a2b0-79027ae26a5e@linux.dev>
Date: Wed, 27 Aug 2025 19:46:39 -0700
From: Zhu Yanjun <yanjun.zhu@...ux.dev>
To: Liao Yuanhong <liaoyuanhong@...o.com>, Tariq Toukan <tariqt@...dia.com>,
 Andrew Lunn <andrew+netdev@...n.ch>, "David S. Miller"
 <davem@...emloft.net>, Eric Dumazet <edumazet@...gle.com>,
 Jakub Kicinski <kuba@...nel.org>, Paolo Abeni <pabeni@...hat.com>,
 "open list:MELLANOX MLX4 core VPI driver" <netdev@...r.kernel.org>,
 "open list:MELLANOX MLX4 core VPI driver" <linux-rdma@...r.kernel.org>,
 open list <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH net-next] net/mlx4: Remove redundant ternary operators

在 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@...o.com>
> ---
>   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@...ux.dev>

Zhu Yanjun

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


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ