IB/hfi1: fix a locking bug

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>
This commit is contained in:
Dan Carpenter 2015-09-16 09:22:51 +03:00 committed by Doug Ledford
parent 50b19729ce
commit 951842b054

View File

@ -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);
}
@ -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);
}