summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBryan Tan <bryantan@vmware.com>2017-12-20 20:50:01 +0300
committerJason Gunthorpe <jgg@mellanox.com>2017-12-22 02:06:07 +0300
commit30a366a9dabd05a0d218288b7d732649886b6a53 (patch)
tree91063c22f2e3d58d749f7f275a17f28da4e806a1
parent17748056ce123ee37fb7382bc698fc721e3c4a09 (diff)
downloadlinux-30a366a9dabd05a0d218288b7d732649886b6a53.tar.xz
RDMA/vmw_pvrdma: Use refcount_dec_and_test to avoid warning
refcount_dec generates a warning when the operation causes the refcount to hit zero. Avoid this by using refcount_dec_and_test. Fixes: 8b10ba783c9d ("RDMA/vmw_pvrdma: Add shared receive queue support") Reviewed-by: Adit Ranadive <aditr@vmware.com> Reviewed-by: Aditya Sarwade <asarwade@vmware.com> Reviewed-by: Jorgen Hansen <jhansen@vmware.com> Signed-off-by: Bryan Tan <bryantan@vmware.com> Reviewed-by: Leon Romanovsky <leonro@mellanox.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
-rw-r--r--drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
index 826ccb864596..a2b1a3c115f2 100644
--- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
+++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_srq.c
@@ -236,8 +236,8 @@ static void pvrdma_free_srq(struct pvrdma_dev *dev, struct pvrdma_srq *srq)
dev->srq_tbl[srq->srq_handle] = NULL;
spin_unlock_irqrestore(&dev->srq_tbl_lock, flags);
- refcount_dec(&srq->refcnt);
- wait_event(srq->wait, !refcount_read(&srq->refcnt));
+ if (!refcount_dec_and_test(&srq->refcnt))
+ wait_event(srq->wait, !refcount_read(&srq->refcnt));
/* There is no support for kernel clients, so this is safe. */
ib_umem_release(srq->umem);