Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754663AbbERSf3 (ORCPT ); Mon, 18 May 2015 14:35:29 -0400 Received: from mail-wi0-f169.google.com ([209.85.212.169]:38133 "EHLO mail-wi0-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754552AbbERSfY (ORCPT ); Mon, 18 May 2015 14:35:24 -0400 From: Adrian Remonda Cc: Adrian Remonda , Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Julia Lawall , Joe Perches , Aya Mahfouz , Greg Donald , HPDD-discuss@ml01.01.org (moderated list:STAGING - LUSTRE...), devel@driverdev.osuosl.org (open list:STAGING SUBSYSTEM), linux-kernel@vger.kernel.org (open list) Subject: [PATCH 4/4] Staging: lustre: sparse lock warning fix Date: Mon, 18 May 2015 20:34:51 +0200 Message-Id: <1431974091-26363-5-git-send-email-adrianremonda@gmail.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: <1431974091-26363-4-git-send-email-adrianremonda@gmail.com> References: <1431974091-26363-1-git-send-email-adrianremonda@gmail.com> <1431974091-26363-2-git-send-email-adrianremonda@gmail.com> <1431974091-26363-3-git-send-email-adrianremonda@gmail.com> <1431974091-26363-4-git-send-email-adrianremonda@gmail.com> To: unlisted-recipients:; (no To-header on input) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1144 Lines: 37 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/