From: Yunjian Wang Date: Wed, 21 Oct 2020 11:19:49 +0000 (+0800) Subject: eal: report duplicate device event callback X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=1cdb89c177269a0756f82ae3eb057fe34e205f41;p=dpdk.git 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 --- 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);