From: Dan Carpenter Date: Wed, 16 Sep 2015 06:22:51 +0000 (+0300) Subject: IB/hfi1: fix a locking bug X-Git-Url: http://git.lede-project.org./?a=commitdiff_plain;h=951842b0540d2ed49ae29ba968adc496baf46556;p=openwrt%2Fstaging%2Fblogic.git IB/hfi1: fix a locking bug mutex_trylock() returns zero on failure, not EBUSY. Signed-off-by: Dan Carpenter Signed-off-by: Doug Ledford --- diff --git a/drivers/staging/rdma/hfi1/chip.c b/drivers/staging/rdma/hfi1/chip.c index 654eafef1d30..aa58e597df06 100644 --- a/drivers/staging/rdma/hfi1/chip.c +++ b/drivers/staging/rdma/hfi1/chip.c @@ -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); }