[dpdk-stable] [dpdk-dev] [PATCH v3 2/2] eal: return error code when failure

wangyunjian wangyunjian at huawei.com
Thu Jul 2 13:47:19 CEST 2020


From: Yunjian Wang <wangyunjian at huawei.com>

Fix return value, using -EAGAIN instead of 0 when the callback is busy
and using -ENOENT instead of 0 when the callback is not found.

Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: stable at dpdk.org

Signed-off-by: Yunjian Wang <wangyunjian at huawei.com>
Acked-by: Jeff Guo <jia.guo at intel.com>
---
 lib/librte_eal/common/eal_common_dev.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c
index 4cfdb80..f8df8d4 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -531,9 +531,15 @@ static int cmp_dev_name(const struct rte_device *dev, const void *_name)
 			free(event_cb);
 			ret++;
 		} else {
-			continue;
+			ret = -EAGAIN;
+			break;
 		}
 	}
+
+	/* this callback is not be registered */
+	if (ret == 0)
+		ret = -ENOENT;
+
 	rte_spinlock_unlock(&dev_event_lock);
 	return ret;
 }
-- 
1.8.3.1




More information about the stable mailing list