All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Tolga Ceylan <tolga.ceylan@gmail.com>
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@ml01.01.org, devel@driverdev.osuosl.org,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning
Date: Wed, 3 Jun 2015 12:12:59 +0530	[thread overview]
Message-ID: <20150603064259.GE4936@sudip-PC> (raw)
In-Reply-To: <1433275040-23345-1-git-send-email-tolga.ceylan@gmail.com>

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	


  reply	other threads:[~2015-06-03  6:43 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-02 19:57 [PATCH 1/1] staging: lustre/lustre/obdclass/llog_cat.c: get rid of sparse context imbalance warning Tolga Ceylan
2015-06-03  6:42 ` Sudip Mukherjee [this message]
2015-06-03 15:47   ` Tolga Ceylan
2015-06-03 16:36     ` Sudip Mukherjee
  -- strict thread matches above, loose matches on Subject: below --
2015-06-03 20:20 Tolga Ceylan
2015-06-08 19:35 ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150603064259.GE4936@sudip-PC \
    --to=sudipm.mukherjee@gmail.com \
    --cc=HPDD-discuss@ml01.01.org \
    --cc=Julia.Lawall@lip6.fr \
    --cc=andreas.dilger@intel.com \
    --cc=arjunak234@gmail.com \
    --cc=darshanapadmadas@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gdonald@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oleg.drokin@intel.com \
    --cc=tolga.ceylan@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.