[1/2] mempool: add rte_errno in rte_mempool_set_ops_byname
Checks
Commit Message
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.otilibili@6wind.com>
---
lib/mempool/rte_mempool_ops.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
@@ -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;