Skip to contentSkip to conversation

devargs: fix freeing during device removal

PATCH Applied Thomas Monjalon 1 participant 2 messages Oct 18, 2018 – Oct 19, 2018

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 devargs: fix freeing during device removal

After calling unplug function of a bus, the device is expected to be freed. It is too late for getting devargs to remove. Anyway, the buses which implement unplug are already freeing the devargs, except the PCI bus.
So the call to rte_devargs_remove() is removed from EAL and added in PCI.

Fixes 2effa126fbd8 ("devargs: simplify parameters of removal function")
---
 drivers/bus/pci/pci_common.c           | 1 +
 lib/librte_eal/common/eal_common_dev.c | 2 --
 2 files changed, 1 insertion(+), 2 deletions(-)
drivers/bus/pci/pci_common.c +1 -0
index 41f8fc27e..feb79803c 100644
@@ -522,6 +522,7 @@ pci_unplug(struct rte_device *dev)
 	ret = rte_pci_detach_dev(pdev);
 	if (ret == 0) {
 		rte_pci_remove_device(pdev);
+		rte_devargs_remove(dev->devargs);
 		free(pdev);
 	}
 	return ret;
lib/librte_eal/common/eal_common_dev.c +0 -2
index 0c873bfe0..8b0844af1 100644
@@ -372,8 +372,6 @@ local_dev_remove(struct rte_device *dev)
 		return ret;
 	}
 
-	rte_devargs_remove(dev->devargs);
-
 	return 0;
 }
 
Signature · 1 line
2.19.0
author Applied
#1 lore raw

18/10/2018 02:19, Thomas Monjalon:

Quoted 10 lines

After calling unplug function of a bus, the device is expected to be freed. It is too late for getting devargs to remove. Anyway, the buses which implement unplug are already freeing the devargs, except the PCI bus.
So the call to rte_devargs_remove() is removed from EAL and added in PCI.

Fixes 2effa126fbd8 ("devargs: simplify parameters of removal function")

Applied