[RFC 05/11] bus/fslmc: fix per type device count

David Marchand david.marchand at redhat.com
Thu Jul 23 15:53:53 CEST 2026


When blocklisting some device, the per type count was wrong.

Signed-off-by: David Marchand <david.marchand at redhat.com>
---
 drivers/bus/fslmc/fslmc_bus.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index 94685a0f5a..a7ac59173f 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -83,11 +83,17 @@ insert_in_device_list(struct rte_dpaa2_device *newdev)
 
 	if (!inserted)
 		rte_bus_add_device(&rte_fslmc_bus, &newdev->device);
+
+	if (newdev->dev_type < DPAA2_DEVTYPE_MAX)
+		fslmc_bus_device_count[newdev->dev_type]++;
 }
 
 void
 fslmc_bus_remove_device(struct rte_dpaa2_device *dev)
 {
+	if (dev->dev_type < DPAA2_DEVTYPE_MAX)
+		fslmc_bus_device_count[dev->dev_type]--;
+
 	rte_bus_remove_device(&rte_fslmc_bus, &dev->device);
 	rte_intr_instance_free(dev->intr_handle);
 	free(dev);
@@ -195,9 +201,6 @@ scan_one_fslmc_device(char *dev_name)
 	}
 	dev->device.devargs = rte_bus_find_devargs(&rte_fslmc_bus, dev_name);
 
-	/* Update the device found into the device_count table */
-	fslmc_bus_device_count[dev->dev_type]++;
-
 	/* Add device in the fslmc device list */
 	insert_in_device_list(dev);
 
-- 
2.54.0



More information about the dev mailing list