From: Zhu Yanjun <yanjun.zhu@linux.dev>
To: Liao Yuanhong <liaoyuanhong@vivo.com>,
Tariq Toukan <tariqt@nvidia.com>,
Andrew Lunn <andrew+netdev@lunn.ch>,
"David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
"open list:MELLANOX MLX4 core VPI driver"
<netdev@vger.kernel.org>,
"open list:MELLANOX MLX4 core VPI driver"
<linux-rdma@vger.kernel.org>,
open list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH net-next] net/mlx4: Remove redundant ternary operators
Date: Wed, 27 Aug 2025 19:46:39 -0700 [thread overview]
Message-ID: <5b197403-4f7c-4d59-a2b0-79027ae26a5e@linux.dev> (raw)
In-Reply-To: <20250827121503.497138-1-liaoyuanhong@vivo.com>
在 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@vivo.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@linux.dev>
Zhu Yanjun
> }
>
> int __mlx4_register_mac(struct mlx4_dev *dev, u8 port, u64 mac)
next prev parent reply other threads:[~2025-08-28 2:46 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-27 12:15 [PATCH net-next] net/mlx4: Remove redundant ternary operators Liao Yuanhong
2025-08-28 2:46 ` Zhu Yanjun [this message]
2025-08-28 19:09 ` Simon Horman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5b197403-4f7c-4d59-a2b0-79027ae26a5e@linux.dev \
--to=yanjun.zhu@linux.dev \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=liaoyuanhong@vivo.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-rdma@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=tariqt@nvidia.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox