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)
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)
if (qp->mb_mgr_mz)
rte_memzone_free(qp->mb_mgr_mz);
#endif
- if (qp)
- rte_free(qp);
+ rte_free(qp);
return ret;
}