/* Clean up/close an IA. o if event handles and PD have been initialized, free them. o close the IA  */
void rpcrdma_ia_close(struct rpcrdma_ia *ia)
/* Clean up/close an IA. o if event handles and PD have been initialized, free them. o close the IA  */
void rpcrdma_ia_close(struct rpcrdma_ia *ia)
{
	int rc;
	dprintk("RPC:       %s: entering\n", __func__);
	if (ia->ri_bind_mem != NULL) {
		rc = ib_dereg_mr(ia->ri_bind_mem);
		dprintk("RPC:       %s: ib_dereg_mr returned %i\n",
			__func__, rc);
	}
	if (ia->ri_id != NULL && !IS_ERR(ia->ri_id)) {
		if (ia->ri_id->qp)
			rdma_destroy_qp(ia->ri_id);
		rdma_destroy_id(ia->ri_id);
		ia->ri_id = NULL;
	}
	if (ia->ri_pd != NULL && !IS_ERR(ia->ri_pd)) {
		rc = ib_dealloc_pd(ia->ri_pd);
		dprintk("RPC:       %s: ib_dealloc_pd returned %i\n",
			__func__, rc);
	}
}