From 3f01891391a1f9320549598a5ffef29415a4a3d7 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 21 Oct 2020 19:19:23 +0800 Subject: [PATCH] eal: return errors on device event callback unregister 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") Signed-off-by: Yunjian Wang Acked-by: Jeff Guo Acked-by: David Marchand --- 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 363a2ca95e..d990bfd20d 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -530,9 +530,15 @@ rte_dev_event_callback_unregister(const char *device_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; } -- 2.20.1