From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753151AbbFCGnQ (ORCPT ); Wed, 3 Jun 2015 02:43:16 -0400 Received: from mail-pa0-f47.google.com ([209.85.220.47]:35025 "EHLO mail-pa0-f47.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752539AbbFCGnH (ORCPT ); Wed, 3 Jun 2015 02:43:07 -0400 Date: Wed, 3 Jun 2015 12:12:59 +0530 From: Sudip Mukherjee To: Tolga Ceylan Cc: Oleg Drokin , Andreas Dilger , Greg Kroah-Hartman , Julia Lawall , Greg Donald , Joe Perches , Darshana Padmadas , Arjun AK , 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 Message-ID: <20150603064259.GE4936@sudip-PC> References: <1433275040-23345-1-git-send-email-tolga.ceylan@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1433275040-23345-1-git-send-email-tolga.ceylan@gmail.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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