Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1157118

Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Sudip Mukherjee <sudipm.mukherjee@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning
Date Wed, 03 Jun 2015 08:50:01 +0200
Message-ID <pxaEV-186-5@gated-at.bofh.it> (permalink)
References <px0vU-2W2-9@gated-at.bofh.it>
X-Original-To Tolga Ceylan <tolga.ceylan@gmail.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=8ela0K3+TW6SO55KG1hEgxzTOWcyFVcHBqqzGg7sEEc=; b=RioTxjFAUhy+9MK28KAXZmNy5zfGKvpeAjmJm3TOzHaqMf8nXZSwJ8FZaJgw6Q+22e x7Xv2pXib3Uu7xwtxBUHYo+dDs9jXpEZ1Bjy2mdrg9YdZTDh/RaZqQNryGmxJ8YOhfBC oPdd0r3vMmoj9Mr7I4XxtNthyVurEXD1jDN1CoFr5OPqbapqrLMLoRpjlfl1MO+j6O1t TeO6twJ6pooIFoeOc/AzBtkEI80w0HvqxQ+x3HSVeIrImGXY69tUjuLdB0ObvmWe2EF8 +jIFQ/aTrG+lYs1eKydI9klZZFNRQXdhNX+8iE8Q4sHaKFnwl12ywXgHo3ukjlV+DMM8 4VJA==
X-Received by 10.70.42.134 with SMTP id o6mr26611716pdl.11.1433313787221; Tue, 02 Jun 2015 23:43:07 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 40
Organization linux.* mail to news gateway
X-Original-Cc Oleg Drokin <oleg.drokin@intel.com>, Andreas Dilger <andreas.dilger@intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Julia Lawall <Julia.Lawall@lip6.fr>, Greg Donald <gdonald@gmail.com>, Joe Perches <joe@perches.com>, Darshana Padmadas <darshanapadmadas@gmail.com>, Arjun AK <arjunak234@gmail.com>, HPDD-discuss@lists.01.org, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org
X-Original-Date Wed, 3 Jun 2015 12:12:59 +0530
X-Original-Message-ID <20150603064259.GE4936@sudip-PC>
X-Original-References <1433275040-23345-1-git-send-email-tolga.ceylan@gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref aioe.org linux.kernel:1157118

Show key headers only | View raw


On Tue, Jun 02, 2015 at 12:57:20PM -0700, Tolga Ceylan wrote:
> In llog_cat_new_log(), sparse emits a context imbalance (unexpected lock)
> warning due its inability to detect the noreturn attribute in
> lbug_with_lock() function inside LBUG macro. Adding a never reached
> return statement suppresses this warning.
but adding a statement which never executes, is that the correct solution?
what about :

diff --git a/drivers/staging/lustre/lustre/obdclass/llog_cat.c b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
index c8f6ab0..1cb3495 100644
--- a/drivers/staging/lustre/lustre/obdclass/llog_cat.c
+++ b/drivers/staging/lustre/lustre/obdclass/llog_cat.c
@@ -103,13 +103,12 @@ static int llog_cat_new_log(const struct lu_env *env,
 
 	spin_lock(&loghandle->lgh_hdr_lock);
 	llh->llh_count++;
-	if (ext2_set_bit(index, llh->llh_bitmap)) {
-		CERROR("argh, index %u already set in log bitmap?\n",
-		       index);
-		spin_unlock(&loghandle->lgh_hdr_lock);
+	rc = ext2_set_bit(index, llh->llh_bitmap);
+	spin_unlock(&loghandle->lgh_hdr_lock);
+	if (rc) {
+		CERROR("argh, index %u already set in log bitmap?\n", index);
 		LBUG(); /* should never happen */
 	}
-	spin_unlock(&loghandle->lgh_hdr_lock);
 
 	cathandle->lgh_last_idx = index;
 	llh->llh_tail.lrt_index = index;


regards
sudip	

--
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/

Back to linux.kernel | Previous | NextNext in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid  of sparse context imbalance warning Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-06-03 08:50 +0200
  Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid  of sparse context imbalance warning Tolga Ceylan <tolga.ceylan@gmail.com> - 2015-06-03 17:50 +0200
    Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid  of sparse context imbalance warning Sudip Mukherjee <sudipm.mukherjee@gmail.com> - 2015-06-03 18:40 +0200

csiph-web