[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20221020033425.11471-1-xiaolinkui@126.com>
Date: Thu, 20 Oct 2022 11:34:25 +0800
From: xiaolinkui <xiaolinkui@....com>
To: jesse.brandeburg@...el.com, anthony.l.nguyen@...el.com,
davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org,
pabeni@...hat.com, xiaolinkui@....com
Cc: intel-wired-lan@...ts.osuosl.org, netdev@...r.kernel.org,
Linkui Xiao <xiaolinkui@...inos.cn>
Subject: [PATCH] i40e: add a fault tolerance judgment
From: Linkui Xiao <xiaolinkui@...inos.cn>
Avoid requesting memory when system memory resources are insufficient.
Reference function i40e_setup_tx_descriptors, adding fault tolerance
handling.
Signed-off-by: Linkui Xiao <xiaolinkui@...inos.cn>
---
drivers/net/ethernet/intel/i40e/i40e_txrx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_txrx.c b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
index d4226161a3ef..673f2f0d078f 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_txrx.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_txrx.c
@@ -1565,6 +1565,9 @@ int i40e_setup_rx_descriptors(struct i40e_ring *rx_ring)
struct device *dev = rx_ring->dev;
int err;
+ if (!dev)
+ return -ENOMEM;
+
u64_stats_init(&rx_ring->syncp);
/* Round up to nearest 4K */
--
2.17.1
Powered by blists - more mailing lists