Skip to content

Commit

Permalink
IB/hfi1: fix a locking bug
Browse files Browse the repository at this point in the history
mutex_trylock() returns zero on failure, not EBUSY.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Dan Carpenter authored and Doug Ledford committed Sep 18, 2015
1 parent 50b1972 commit 951842b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions drivers/staging/rdma/hfi1/chip.c
Original file line number Diff line number Diff line change
Expand Up @@ -2710,7 +2710,7 @@ int acquire_lcb_access(struct hfi1_devdata *dd, int sleep_ok)
if (sleep_ok) {
mutex_lock(&ppd->hls_lock);
} else {
while (mutex_trylock(&ppd->hls_lock) == EBUSY)
while (!mutex_trylock(&ppd->hls_lock))
udelay(1);
}

Expand Down Expand Up @@ -2758,7 +2758,7 @@ int release_lcb_access(struct hfi1_devdata *dd, int sleep_ok)
if (sleep_ok) {
mutex_lock(&dd->pport->hls_lock);
} else {
while (mutex_trylock(&dd->pport->hls_lock) == EBUSY)
while (!mutex_trylock(&dd->pport->hls_lock))
udelay(1);
}

Expand Down

0 comments on commit 951842b

Please sign in to comment.