[PATCH 4/4] Staging: lustre: sparse lock warning fix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Fixed sparse warning: context imbalance in 'nrs_resource_put_safe' -
'different lock contexts for basic block' by releasing the lock on each
iteration of the for loop.

Signed-off-by: Adrian Remonda <adrianremonda@xxxxxxxxx>
---
 drivers/staging/lustre/lustre/ptlrpc/nrs.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
index 43da95f0bce2..3a1722437ca1 100644
--- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c
+++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c
@@ -503,13 +503,11 @@ static void nrs_resource_put_safe(struct ptlrpc_nrs_resource **resp)
 
 		if (nrs == NULL) {
 			nrs = pols[i]->pol_nrs;
-			spin_lock(&nrs->nrs_lock);
 		}
+		spin_lock(&nrs->nrs_lock);
 		nrs_policy_put_locked(pols[i]);
-	}
-
-	if (nrs != NULL)
 		spin_unlock(&nrs->nrs_lock);
+	}
 }
 
 /**
-- 
2.1.4

_______________________________________________
devel mailing list
devel@xxxxxxxxxxxxxxxxxxxxxx
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel




[Index of Archives]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux