eal: report duplicate device event callback
authorYunjian Wang <wangyunjian@huawei.com>
Wed, 21 Oct 2020 11:19:49 +0000 (19:19 +0800)
committerDavid Marchand <david.marchand@redhat.com>
Fri, 23 Oct 2020 11:35:56 +0000 (13:35 +0200)
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 <wangyunjian@huawei.com>
Acked-by: David Marchand <david.marchand@redhat.com>
lib/librte_eal/common/eal_common_dev.c

index d990bfd..8a3bd31 100644 (file)
@@ -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);