Skip to contentSkip to conversation

net/cpfl: cancel alarm when fail to init adapter

PATCH Applied [email protected] 2 participants 2 messages Mar 20, 2023 – Mar 21, 2023 Network drivers

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net/cpfl: cancel alarm when fail to init adapter

From: Beilei Xing <[email protected]>

Cancel alarm if failing to allocate vports memory during adapter_ext initialization. Otherwise, there'll be segmentation fault when fail to initialize adapter_ext.

Fixes 2d823ecd671c ("net/cpfl: support device initialization")
---
 drivers/net/cpfl/cpfl_ethdev.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/net/cpfl/cpfl_ethdev.c +3 -2
index 54261d5743..ede730fd50 100644
@@ -1199,7 +1199,7 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
 	if (adapter->vports == NULL) {
 		PMD_INIT_LOG(ERR, "Failed to allocate vports memory");
 		ret = -ENOMEM;
-		goto err_get_ptype;
+		goto err_vports_alloc;
 	}
 
 	adapter->cur_vports = 0;
@@ -1209,7 +1209,8 @@ cpfl_adapter_ext_init(struct rte_pci_device *pci_dev, struct cpfl_adapter_ext *a
 
 	return ret;
 
-err_get_ptype:
+err_vports_alloc:
+	rte_eal_alarm_cancel(cpfl_dev_alarm_handler, adapter);
 	idpf_adapter_deinit(base);
 err_adapter_init:
 	return ret;
Signature · 1 line
2.26.2
Acked-by on v1 1/1 Applied
#1 lore raw
Quoted 11 lines

-----Original Message-----
From: [email protected] <[email protected]>
Sent: Monday, March 20, 2023 3:30 PM
To: Zhang, Yuying <[email protected]>
Cc: [email protected]; Xing, Beilei <[email protected]>
Subject: [PATCH] net/cpfl: cancel alarm when fail to init adapter

From: Beilei Xing <[email protected]>

Quoted 7 lines

Cancel alarm if failing to allocate vports memory during adapter_ext initialization. Otherwise, there'll be segmentation fault when fail to initialize adapter_ext.

Fixes 2d823ecd671c ("net/cpfl: support device initialization")

Applied to dpdk-next-net-intel.

Thanks
Qi