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] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250709022210.304030-4-rongqianfeng@vivo.com>
Date: Wed,  9 Jul 2025 10:21:31 +0800
From: Qianfeng Rong <rongqianfeng@...o.com>
To: Veerasenareddy Burru <vburru@...vell.com>,
	Sathesh Edara <sedara@...vell.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>,
	netdev@...r.kernel.org (open list:MARVELL OCTEON ENDPOINT DRIVER),
	linux-kernel@...r.kernel.org (open list)
Cc: Qianfeng Rong <rongqianfeng@...o.com>
Subject: [PATCH 03/12] ethernet: octeon_ep: Use min() to improve code

Use min() to reduce the code and improve its readability.

Signed-off-by: Qianfeng Rong <rongqianfeng@...o.com>
---
 drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
index ebecdd29f3bd..cfae09bf6fea 100644
--- a/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
+++ b/drivers/net/ethernet/marvell/octeon_ep/octep_pfvf_mbox.c
@@ -39,10 +39,7 @@ static void octep_pfvf_validate_version(struct octep_device *oct,  u32 vf_id,
 
 	dev_dbg(&oct->pdev->dev, "VF id:%d VF version:%d PF version:%d\n",
 		vf_id, vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
-	if (vf_version < OCTEP_PFVF_MBOX_VERSION_CURRENT)
-		rsp->s_version.version = vf_version;
-	else
-		rsp->s_version.version = OCTEP_PFVF_MBOX_VERSION_CURRENT;
+	rsp->s_version.version = min(vf_version, OCTEP_PFVF_MBOX_VERSION_CURRENT);
 
 	oct->vf_info[vf_id].mbox_version = rsp->s_version.version;
 	dev_dbg(&oct->pdev->dev, "VF id:%d negotiated VF version:%d\n",
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ