New upstream version 18.11-rc2
[deb_dpdk.git] / lib / librte_compressdev / rte_comp.c
index 98ad0cf..4634c12 100644 (file)
@@ -83,8 +83,8 @@ struct rte_comp_op_pool_private {
  * @param nb_ops
  *   Number of operations to allocate
  * @return
- *   - 0: Success
- *   - -ENOENT: Not enough entries in the mempool; no ops are retrieved.
+ *   - nb_ops: Success, the nb_ops requested was allocated
+ *   - 0: Not enough entries in the mempool; no ops are retrieved.
  */
 static inline int
 rte_comp_op_raw_bulk_alloc(struct rte_mempool *mempool,
@@ -174,7 +174,7 @@ rte_comp_op_alloc(struct rte_mempool *mempool)
        int retval;
 
        retval = rte_comp_op_raw_bulk_alloc(mempool, &op, 1);
-       if (unlikely(retval < 0))
+       if (unlikely(retval != 1))
                return NULL;
 
        rte_comp_op_reset(op);
@@ -186,12 +186,12 @@ int __rte_experimental
 rte_comp_op_bulk_alloc(struct rte_mempool *mempool,
                struct rte_comp_op **ops, uint16_t nb_ops)
 {
-       int ret;
+       int retval;
        uint16_t i;
 
-       ret = rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops);
-       if (unlikely(ret < nb_ops))
-               return ret;
+       retval = rte_comp_op_raw_bulk_alloc(mempool, ops, nb_ops);
+       if (unlikely(retval != nb_ops))
+               return 0;
 
        for (i = 0; i < nb_ops; i++)
                rte_comp_op_reset(ops[i]);