Message ID | 1389307663-11296-11-git-send-email-umalhi@cisco.com (mailing list archive) |
---|---|
State | Accepted, archived |
Headers | show |
diff --git a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c index e7bec23..06c21be 100644 --- a/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c +++ b/drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c @@ -395,15 +395,16 @@ static int qp_grp_and_vf_bind(struct usnic_ib_vf *vf, lockdep_assert_held(&vf->lock); pdev = usnic_vnic_get_pdev(vf->vnic); - if (vf->qp_grp_ref_cnt++ == 0) { - vf->pd = pd; + if (vf->qp_grp_ref_cnt == 0) { err = usnic_uiom_attach_dev_to_pd(pd->umem_pd, &pdev->dev); if (err) { usnic_err("Failed to attach %s to domain\n", pci_name(pdev)); return err; } + vf->pd = pd; } + vf->qp_grp_ref_cnt++; WARN_ON(vf->pd != pd); qp_grp->vf = vf;
vf->qp_grp_ref_cnt is incorrectly incremented if usnic_uiom_attach_dev_to_pd fails; vf->pd is also erroneously populated in this same failure path. Signed-off-by: Upinder Malhi <umalhi@cisco.com> --- drivers/infiniband/hw/usnic/usnic_ib_qp_grp.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)