From 1cdb89c177269a0756f82ae3eb057fe34e205f41 Mon Sep 17 00:00:00 2001 From: Yunjian Wang Date: Wed, 21 Oct 2020 19:19:49 +0800 Subject: [PATCH] eal: report duplicate device event callback We should return an error value, when the callback is already exist. Fixes: a753e53d517b ("eal: add device event monitor framework") Signed-off-by: Yunjian Wang Acked-by: David Marchand --- lib/librte_eal/common/eal_common_dev.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c index d990bfd20d..8a3bd3100a 100644 --- a/lib/librte_eal/common/eal_common_dev.c +++ b/lib/librte_eal/common/eal_common_dev.c @@ -480,7 +480,9 @@ rte_dev_event_callback_register(const char *device_name, RTE_LOG(ERR, EAL, "The callback is already exist, no need " "to register again.\n"); + event_cb = NULL; ret = -EEXIST; + goto error; } rte_spinlock_unlock(&dev_event_lock); -- 2.20.1