net/txgbe: fix queue statistics mapping
[dpdk.git] / drivers / crypto / ipsec_mb / ipsec_mb_ops.c
index 189262c..7e8396b 100644 (file)
@@ -102,8 +102,7 @@ ipsec_mb_qp_release(struct rte_cryptodev *dev, uint16_t qp_id)
 
        if (qp != NULL && rte_eal_process_type() == RTE_PROC_PRIMARY) {
                r = rte_ring_lookup(qp->name);
-               if (r)
-                       rte_ring_free(r);
+               rte_ring_free(r);
 
 #if IMB_VERSION(1, 1, 0) > IMB_VERSION_NUM
                if (qp->mb_mgr)
@@ -221,8 +220,11 @@ ipsec_mb_qp_setup(struct rte_cryptodev *dev, uint16_t qp_id,
                                IMB_VERSION_STR, IMB_MP_REQ_VER_STR);
                return -EINVAL;
 #endif
-               if (dev->data->queue_pairs[qp_id] != NULL)
-                       qp = dev->data->queue_pairs[qp_id];
+               qp = dev->data->queue_pairs[qp_id];
+               if (qp == NULL) {
+                       IPSEC_MB_LOG(ERR, "Primary process hasn't configured device qp.");
+                       return -EINVAL;
+               }
        } else {
                /* Free memory prior to re-allocation if needed. */
                if (dev->data->queue_pairs[qp_id] != NULL)
@@ -291,8 +293,7 @@ qp_setup_cleanup:
        if (qp->mb_mgr_mz)
                rte_memzone_free(qp->mb_mgr_mz);
 #endif
-       if (qp)
-               rte_free(qp);
+       rte_free(qp);
        return ret;
 }