[dpdk-dev,v2,1/2] mempool/dpaa2: fix the return value for alloc fail

Message ID 1498135688-3853-1-git-send-email-hemant.agrawal@nxp.com (mailing list archive)
State Accepted, archived
Delegated to: Thomas Monjalon
Headers

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Hemant Agrawal June 22, 2017, 12:48 p.m. UTC
  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>
---
 drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Olivier Matz July 10, 2017, 8:10 a.m. UTC | #1
On Thu, 22 Jun 2017 18:18:07 +0530, Hemant Agrawal <hemant.agrawal@nxp.com> wrote:
> 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>
  
Shreyansh Jain July 18, 2017, 2:47 p.m. UTC | #2
On Thursday 22 June 2017 06:18 PM, Hemant Agrawal wrote:
> 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>
> ---

Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>
  
Thomas Monjalon July 21, 2017, 6:29 a.m. UTC | #3
18/07/2017 17:47, Shreyansh Jain:
> On Thursday 22 June 2017 06:18 PM, Hemant Agrawal wrote:
> > 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>
> 
> Acked-by: Shreyansh Jain <shreyansh.jain@nxp.com>

Series applied, thanks
  

Patch

diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
index 5a5d6aa..27ed5a9 100644
--- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
+++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c
@@ -294,7 +294,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++) {