bus: invoke TAILQ_REMOVE when bus cleanup
Checks
Commit Message
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@dpdk.org
Signed-off-by: Chengwen Feng <fengchengwen@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(+)
Comments
> From: Chengwen Feng [mailto:fengchengwen@huawei.com]
> Sent: Thursday, 20 February 2025 09.09
>
> 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@dpdk.org
>
> Signed-off-by: Chengwen Feng <fengchengwen@huawei.com>
> ---
Thank you for cleaning this up.
Acked-by: Morten Brørup <mb@smartsharesystems.com>
@@ -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));
}
@@ -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);
}
@@ -596,6 +596,7 @@ vdev_cleanup(void)
dev->device.driver = NULL;
free:
+ TAILQ_REMOVE(&vdev_device_list, dev, next);
free(dev);
}
@@ -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);
}