According to API, 'rte_dev_probe()' and 'rte_dev_remove()' and their
'hotplug' equivalents must return 0 or negative error code. Bus code
returns positive values if device wasn't recognized by any driver, so
the result of 'bus->plug/unplug()' must be converted.

Positive on remove means that device not found by driver.
Positive on probe means that there are no suitable buses/drivers,
i.e. device is not supported.

CC: sta...@dpdk.org
Fixes: a3ee360f4440 ("eal: add hotplug add/remove device")
Fixes: 244d5130719c ("eal: enable hotplug on multi-process")

Signed-off-by: Ilya Maximets <i.maxim...@samsung.com>
---
 lib/librte_eal/common/eal_common_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/librte_eal/common/eal_common_dev.c 
b/lib/librte_eal/common/eal_common_dev.c
index 824b8f926..f9cae8e26 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -233,7 +233,7 @@ rte_dev_probe(const char *devargs)
                 * process.
                 */
                if (ret != -EEXIST)
-                       return ret;
+                       return (ret < 0) ? ret : -ENOTSUP;
        }
 
        /* primary send attach sync request to secondary. */
@@ -319,7 +319,7 @@ local_dev_remove(struct rte_device *dev)
        if (ret) {
                RTE_LOG(ERR, EAL, "Driver cannot detach the device (%s)\n",
                        dev->name);
-               return ret;
+               return (ret < 0) ? ret : -ENOENT;
        }
 
        return 0;
-- 
2.17.1

Reply via email to