Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 951842b0 authored by Dan Carpenter's avatar Dan Carpenter Committed by Doug Ledford
Browse files

IB/hfi1: fix a locking bug



mutex_trylock() returns zero on failure, not EBUSY.

Signed-off-by: default avatarDan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: default avatarDoug Ledford <dledford@redhat.com>
parent 50b19729
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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);
	}