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: 8b10ba783c ("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>
This commit is contained in:
Bryan Tan 2017-12-20 09:50:01 -08:00 committed by Jason Gunthorpe
parent 17748056ce
commit 30a366a9da
1 changed files with 2 additions and 2 deletions

View File

@ -236,8 +236,8 @@ static void pvrdma_free_srq(struct pvrdma_dev *dev, struct pvrdma_srq *srq)
dev->srq_tbl[srq->srq_handle] = NULL; dev->srq_tbl[srq->srq_handle] = NULL;
spin_unlock_irqrestore(&dev->srq_tbl_lock, flags); spin_unlock_irqrestore(&dev->srq_tbl_lock, flags);
refcount_dec(&srq->refcnt); if (!refcount_dec_and_test(&srq->refcnt))
wait_event(srq->wait, !refcount_read(&srq->refcnt)); wait_event(srq->wait, !refcount_read(&srq->refcnt));
/* There is no support for kernel clients, so this is safe. */ /* There is no support for kernel clients, so this is safe. */
ib_umem_release(srq->umem); ib_umem_release(srq->umem);