summaryrefslogtreecommitdiffstats
path: root/lib/librte_eal/common/eal_common_dev.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/librte_eal/common/eal_common_dev.c')
-rw-r--r--lib/librte_eal/common/eal_common_dev.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 1fdc9ab1..fd7f5ca7 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -166,18 +166,20 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)
ret = -ENODEV;
goto err_devarg;
}
+ /* Since there is a matching device, it is now its responsibility
+ * to manage the devargs we've just inserted. From this point
+ * those devargs shouldn't be removed manually anymore.
+ */
ret = dev->bus->plug(dev);
- if (ret) {
- if (rte_dev_is_probed(dev)) /* if already succeeded earlier */
- return ret; /* no rollback */
+ if (ret && !rte_dev_is_probed(dev)) { /* if hasn't ever succeeded */
RTE_LOG(ERR, EAL, "Driver cannot attach the device (%s)\n",
dev->name);
- goto err_devarg;
+ return ret;
}
*new_dev = dev;
- return 0;
+ return ret;
err_devarg:
if (rte_devargs_remove(da) != 0) {