mempool/dpaa2: fix error code for allocation failure
authorHemant Agrawal <hemant.agrawal@nxp.com>
Thu, 22 Jun 2017 12:48:07 +0000 (18:18 +0530)
committerThomas Monjalon <thomas@monjalon.net>
Fri, 21 Jul 2017 06:27:58 +0000 (09:27 +0300)
In case the alloc api is not able to allocate the required
number of buffer, it can return '0', which will not indicate
the failure to the calling function.
This patch fix the return value to indicate the failure.

Fixes: 5dc43d22b5ad ("mempool/dpaa2: add hardware offloaded mempool")
Cc: stable@dpdk.org
Signed-off-by: Hemant Agrawal <hemant.agrawal@nxp.com>
Reviewed-by: Olivier Matz <olivier.matz@6wind.com>
Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
drivers/mempool/dpaa2/dpaa2_hw_mempool.c

index 71ae0d6..14ca226 100644 (file)
@@ -300,7 +300,7 @@ rte_dpaa2_mbuf_alloc_bulk(struct rte_mempool *pool,
                        /* Releasing all buffers allocated */
                        rte_dpaa2_mbuf_release(pool, obj_table, bpid,
                                           bp_info->meta_data_size, n);
-                       return ret;
+                       return -ENOBUFS;
                }
                /* assigning mbuf from the acquired objects */
                for (i = 0; (i < ret) && bufs[i]; i++) {