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-next>] [day] [month] [year] [list]
Message-Id: <20240827084005.3815912-1-yanzhen@vivo.com>
Date: Tue, 27 Aug 2024 16:40:05 +0800
From: Yan Zhen <yanzhen@...o.com>
To: louis.peens@...igine.com,
	davem@...emloft.net,
	edumazet@...gle.com,
	pabeni@...hat.com
Cc: kuba@...nel.org,
	oss-drivers@...igine.com,
	netdev@...r.kernel.org,
	linux-kernel@...r.kernel.org,
	opensource.kernel@...o.vom,
	Yan Zhen <yanzhen@...o.com>
Subject: [PATCH v1] netronome: nfp: Use min macro

Using min macro not only makes the code more concise and readable
but also improves efficiency sometimes.

Signed-off-by: Yan Zhen <yanzhen@...o.com>
---
 drivers/net/ethernet/netronome/nfp/nfp_net_common.c      | 4 +---
 drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c | 2 +-
 2 files changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 182ba0a8b095..e6cb255ac914 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2857,10 +2857,8 @@ int nfp_net_init(struct nfp_net *nn)
 	/* Set default MTU and Freelist buffer size */
 	if (!nfp_net_is_data_vnic(nn) && nn->app->ctrl_mtu) {
 		nn->dp.mtu = min(nn->app->ctrl_mtu, nn->max_mtu);
-	} else if (nn->max_mtu < NFP_NET_DEFAULT_MTU) {
-		nn->dp.mtu = nn->max_mtu;
 	} else {
-		nn->dp.mtu = NFP_NET_DEFAULT_MTU;
+		nn->dp.mtu = min(nn->max_mtu, NFP_NET_DEFAULT_MTU);
 	}
 	nn->dp.fl_bufsz = nfp_net_calc_fl_bufsz(&nn->dp);
 
diff --git a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
index 5cfddc9a5d87..3d7225cb24aa 100644
--- a/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/ethernet/netronome/nfp/nfpcore/nfp_nsp_eth.c
@@ -412,7 +412,7 @@ int nfp_eth_config_commit_end(struct nfp_nsp *nsp)
 
 	if (nfp_nsp_config_modified(nsp)) {
 		ret = nfp_nsp_write_eth_table(nsp, entries, NSP_ETH_TABLE_SIZE);
-		ret = ret < 0 ? ret : 0;
+		ret = min(ret, 0);
 	}
 
 	nfp_eth_config_cleanup_end(nsp);
-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ