rte_errno is not set for error exits. For the scenario described in
BugZilla ID 1559, rte_mempool_create_empty() calls
rte_mempool_set_ops_byname(), but does not set as well the proper
rte_errno.

rte_errno is now set in rte_mempool_set_ops_byname(); from there it
cascades down to the calling function.

Bugzilla ID: 1559
Signed-off-by: Ariel Otilibili <ariel.otilib...@6wind.com>
---
 lib/mempool/rte_mempool_ops.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/lib/mempool/rte_mempool_ops.c b/lib/mempool/rte_mempool_ops.c
index 1b33380259b3..b5c68ac61b67 100644
--- a/lib/mempool/rte_mempool_ops.c
+++ b/lib/mempool/rte_mempool_ops.c
@@ -169,8 +169,10 @@ rte_mempool_set_ops_byname(struct rte_mempool *mp, const 
char *name,
        unsigned i;
 
        /* too late, the mempool is already populated. */
-       if (mp->flags & RTE_MEMPOOL_F_POOL_CREATED)
-               return -EEXIST;
+       if (mp->flags & RTE_MEMPOOL_F_POOL_CREATED) {
+               rte_errno = EEXIST;
+               return -rte_errno;
+       }
 
        for (i = 0; i < rte_mempool_ops_table.num_ops; i++) {
                if (!strcmp(name,
@@ -180,8 +182,10 @@ rte_mempool_set_ops_byname(struct rte_mempool *mp, const 
char *name,
                }
        }
 
-       if (ops == NULL)
-               return -EINVAL;
+       if (ops == NULL) {
+               rte_errno = EINVAL;
+               return -rte_errno;
+       }
 
        mp->ops_index = i;
        mp->pool_config = pool_config;
-- 
2.30.2

Reply via email to