From: Yunjian Wang <[email protected]>
We should return an error value, when the callback is already exist.
Fixes: a753e53d517b ("eal: add device event monitor framework")
Cc: [email protected]
Signed-off-by: Yunjian Wang <[email protected]>
---
lib/librte_eal/common/eal_common_dev.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/librte_eal/common/eal_common_dev.c
b/lib/librte_eal/common/eal_common_dev.c
index d990bfd..2a097aa 100644
--- a/lib/librte_eal/common/eal_common_dev.c
+++ b/lib/librte_eal/common/eal_common_dev.c
@@ -431,7 +431,7 @@ static int cmp_dev_name(const struct rte_device *dev, const
void *_name)
void *cb_arg)
{
struct dev_event_callback *event_cb;
- int ret;
+ int ret = 0;
if (!cb_fn)
return -EINVAL;
@@ -484,7 +484,7 @@ static int cmp_dev_name(const struct rte_device *dev, const
void *_name)
}
rte_spinlock_unlock(&dev_event_lock);
- return 0;
+ return ret;
error:
free(event_cb);
rte_spinlock_unlock(&dev_event_lock);
--
1.8.3.1