fslmc_bus_unplug() called drv->remove() and discarded the return value,
unconditionally clearing driver references and reporting success even
when the remove callback signalled failure. As a result, callers had
no way to detect or react to removal errors.
Capture the return value and propagate it to the caller. Only clear
the driver references and log successful unplug when the callback
returns zero.
Fixes: b5721f271cbf ("bus/fslmc: support DPNI hotplug")
Bugzilla ID: 1914
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Md Shofiqul Islam <[email protected]>
---
drivers/bus/fslmc/fslmc_bus.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/bus/fslmc/fslmc_bus.c b/drivers/bus/fslmc/fslmc_bus.c
index cf881b3eec..9cfd8b10ba 100644
--- a/drivers/bus/fslmc/fslmc_bus.c
+++ b/drivers/bus/fslmc/fslmc_bus.c
@@ -620,7 +620,9 @@ fslmc_bus_unplug(struct rte_device *rte_dev)
struct rte_dpaa2_driver *drv = dev->driver;
if (drv && drv->remove) {
- drv->remove(dev);
+ int ret = drv->remove(dev);
+ if (ret)
+ return ret;
dev->driver = NULL;
dev->device.driver = NULL;
DPAA2_BUS_INFO("%s Un-Plugged", dev->device.name);
--
2.54.0.windows.1