[PATCH] bus: invoke TAILQ_REMOVE when bus cleanup
Chengwen Feng
fengchengwen at huawei.com
Thu Feb 20 09:09:06 CET 2025
Although eal_bus_cleanup() is not invoked for multiple times, this is a
good programming habit to remove the device object from list when
cleanup bus.
Fixes: 1cab1a40ea9b ("bus: cleanup devices on shutdown")
Fixes: 62b906cf06ba ("bus/uacce: introduce UACCE bus")
Fixes: 65780eada9d9 ("bus/vmbus: support cleanup")
Cc: stable at dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen at huawei.com>
---
drivers/bus/pci/pci_common.c | 1 +
drivers/bus/uacce/uacce.c | 1 +
drivers/bus/vdev/vdev.c | 1 +
drivers/bus/vmbus/vmbus_common.c | 1 +
4 files changed, 4 insertions(+)
diff --git a/drivers/bus/pci/pci_common.c b/drivers/bus/pci/pci_common.c
index 1173f0887c..2e6d7e43dc 100644
--- a/drivers/bus/pci/pci_common.c
+++ b/drivers/bus/pci/pci_common.c
@@ -459,6 +459,7 @@ pci_cleanup(void)
rte_intr_instance_free(dev->vfio_req_intr_handle);
dev->vfio_req_intr_handle = NULL;
+ TAILQ_REMOVE(&rte_pci_bus.device_list, dev, next);
pci_free(RTE_PCI_DEVICE_INTERNAL(dev));
}
diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c
index 9ca048122d..75a07957bf 100644
--- a/drivers/bus/uacce/uacce.c
+++ b/drivers/bus/uacce/uacce.c
@@ -454,6 +454,7 @@ uacce_cleanup(void)
dev->device.driver = NULL;
free:
+ TAILQ_REMOVE(&uacce_bus.device_list, dev, next);
memset(dev, 0, sizeof(*dev));
free(dev);
}
diff --git a/drivers/bus/vdev/vdev.c b/drivers/bus/vdev/vdev.c
index ec7abe7cda..ae79cfd049 100644
--- a/drivers/bus/vdev/vdev.c
+++ b/drivers/bus/vdev/vdev.c
@@ -596,6 +596,7 @@ vdev_cleanup(void)
dev->device.driver = NULL;
free:
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
free(dev);
}
diff --git a/drivers/bus/vmbus/vmbus_common.c b/drivers/bus/vmbus/vmbus_common.c
index 8a965d10d9..4dac5a6298 100644
--- a/drivers/bus/vmbus/vmbus_common.c
+++ b/drivers/bus/vmbus/vmbus_common.c
@@ -238,6 +238,7 @@ rte_vmbus_cleanup(void)
dev->driver = NULL;
dev->device.driver = NULL;
+ TAILQ_REMOVE(&rte_vmbus_bus.device_list, dev, next);
free(dev);
}
--
2.17.1
More information about the dev
mailing list