qp);
&init_attr->cap, qp);  if (err && pd->uobject) { context = to_mucontext(pd->uobject->context);  mthca_unmap_user_db(to_mdev(pd->device), &context->uar, context->db_tab, ucmd.sq_db_index); mthca_unmap_user_db(to_mdev(pd->device), &context->uar, context->db_tab, ucmd.rq_db_index); }
static struct ib_qp *mthca_create_qp(struct ib_pd *pd,				     struct ib_qp_init_attr *init_attr,				     struct ib_udata *udata){	struct mthca_qp *qp;	int err;	switch (init_attr->qp_type) {	case IB_QPT_RC:	case IB_QPT_UC:	case IB_QPT_UD:	{		qp = kmalloc(sizeof *qp, GFP_KERNEL);		if (!qp)			return ERR_PTR(-ENOMEM);		qp->sq.max    = init_attr->cap.max_send_wr;		qp->rq.max    = init_attr->cap.max_recv_wr;		qp->sq.max_gs = init_attr->cap.max_send_sge;		qp->rq.max_gs = init_attr->cap.max_recv_sge;		err = mthca_alloc_qp(to_mdev(pd->device), to_mpd(pd),				     to_mcq(init_attr->send_cq),				     to_mcq(init_attr->recv_cq),				     init_attr->qp_type, init_attr->sq_sig_type,				     qp);		qp->ibqp.qp_num = qp->qpn;		break;	}	case IB_QPT_SMI:	case IB_QPT_GSI:	{		qp = kmalloc(sizeof (struct mthca_sqp), GFP_KERNEL);		if (!qp)			return ERR_PTR(-ENOMEM);		qp->sq.max    = init_attr->cap.max_send_wr;		qp->rq.max    = init_attr->cap.max_recv_wr;		qp->sq.max_gs = init_attr->cap.max_send_sge;		qp->rq.max_gs = init_attr->cap.max_recv_sge;		qp->ibqp.qp_num = init_attr->qp_type == IB_QPT_SMI ? 0 : 1;		err = mthca_alloc_sqp(to_mdev(pd->device), to_mpd(pd),				      to_mcq(init_attr->send_cq),				      to_mcq(init_attr->recv_cq),				      init_attr->sq_sig_type,				      qp->ibqp.qp_num, init_attr->port_num,				      to_msqp(qp));		break;	}	default:		/* Don't support raw QPs */		return ERR_PTR(-ENOSYS);	}	if (err) {		kfree(qp);		return ERR_PTR(err);	}        init_attr->cap.max_inline_data = 0;	return &qp->ibqp;}