summaryrefslogtreecommitdiff
path: root/drivers/net/failsafe/failsafe_eal.c
diff options
context:
space:
mode:
authorIlya Maximets <i.maximets@samsung.com>2019-06-06 13:02:28 +0300
committerThomas Monjalon <thomas@monjalon.net>2019-06-29 21:28:38 +0200
commit75b66decdbd52948721f5c286244dc1d29d71711 (patch)
tree5eb3b9d311788db1e967c51d03d239e1bdd6cc8f /drivers/net/failsafe/failsafe_eal.c
parent18218713bf4248c4c6b97a12231e7d59b8a86865 (diff)
downloaddpdk-next-eventdev-75b66decdbd52948721f5c286244dc1d29d71711.zip
dpdk-next-eventdev-75b66decdbd52948721f5c286244dc1d29d71711.tar.gz
dpdk-next-eventdev-75b66decdbd52948721f5c286244dc1d29d71711.tar.xz
eal: fix positive error codes from probe/remove
According to API, 'rte_dev_probe()' and 'rte_dev_remove()' 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. 'local_dev_probe()' and 'local_dev_remove()' also has their internal API, so the conversion should be done there. 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. Users of these API fixed to provide a good example by respecting DPDK API. This also will allow to catch such issues in the future. Fixes: a3ee360f4440 ("eal: add hotplug add/remove device") Fixes: 244d5130719c ("eal: enable hotplug on multi-process") Cc: stable@dpdk.org Signed-off-by: Ilya Maximets <i.maximets@samsung.com> Reviewed-by: David Marchand <david.marchand@redhat.com>
Diffstat (limited to 'drivers/net/failsafe/failsafe_eal.c')
-rw-r--r--drivers/net/failsafe/failsafe_eal.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/net/failsafe/failsafe_eal.c b/drivers/net/failsafe/failsafe_eal.c
index 820a915..b9fc508 100644
--- a/drivers/net/failsafe/failsafe_eal.c
+++ b/drivers/net/failsafe/failsafe_eal.c
@@ -48,7 +48,7 @@ fs_bus_init(struct rte_eth_dev *dev)
ret = rte_eal_hotplug_add(da->bus->name,
da->name,
da->args);
- if (ret) {
+ if (ret < 0) {
ERROR("sub_device %d probe failed %s%s%s", i,
rte_errno ? "(" : "",
rte_errno ? strerror(rte_errno) : "",
@@ -147,7 +147,7 @@ fs_bus_uninit(struct rte_eth_dev *dev)
FOREACH_SUBDEV_STATE(sdev, i, dev, DEV_PROBED) {
sdev_ret = rte_dev_remove(sdev->dev);
- if (sdev_ret) {
+ if (sdev_ret < 0) {
ERROR("Failed to remove requested device %s (err: %d)",
sdev->dev->name, sdev_ret);
continue;