[PATCH v14 01/23] net/dpaa: fix device remove

Hemant Agrawal <[email protected]>
Newsgroups org.dpdk.dev
Message-ID <[email protected]>
From: Gagandeep Singh <[email protected]>

Adds a check to not to close device if already closed.

Fixes: 78ea4b4fcb52 ("bus/dpaa: improve cleanup")
Cc: [email protected]

Signed-off-by: Gagandeep Singh <[email protected]>
---
 drivers/net/dpaa/dpaa_ethdev.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 4dc4d1f10c..77730f16e3 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -2677,9 +2677,12 @@ rte_dpaa_remove(struct rte_dpaa_device *dpaa_dev)
 	PMD_INIT_FUNC_TRACE();
 
 	eth_dev = rte_eth_dev_allocated(dpaa_dev->device.name);
-	ret = dpaa_eth_dev_close(eth_dev);
-	if (eth_dev->state !=  RTE_ETH_DEV_UNUSED) {
-		dpaa_eth_dev_close(eth_dev);
+	if (eth_dev && eth_dev->state != RTE_ETH_DEV_UNUSED) {
+		int close_ret = dpaa_eth_dev_close(eth_dev);
+
+		if (close_ret)
+			DPAA_PMD_WARN("%s: close failed (%d), releasing port anyway",
+				dpaa_dev->device.name, close_ret);
 		ret = rte_eth_dev_release_port(eth_dev);
 	}
 	dpaa_valid_dev--;
-- 
2.25.1
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.