All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marcin Slusarz <marcin.slusarz@gmail.com>
To: Amerigo Wang <amwang@redhat.com>
Cc: linux-kernel@vger.kernel.org,
	Alexander Viro <viro@zeniv.linux.org.uk>,
	Jens Axboe <jens.axboe@oracle.com>, Nick Piggin <npiggin@suse.de>,
	linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org,
	"Theodore Ts'o" <tytso@mit.edu>
Subject: Re: [Patch] fs: remove a useless BUG()
Date: Tue, 1 Dec 2009 17:55:11 +0100	[thread overview]
Message-ID: <20091201165440.GA2688@joi.lan> (raw)
In-Reply-To: <20091201023714.3863.92566.sendpatchset@localhost.localdomain>

On Mon, Nov 30, 2009 at 09:34:14PM -0500, Amerigo Wang wrote:
> This BUG() is suspicious, it makes its following statements
> unreachable, 
only when CONFIG_BUG=y

> and it seems to be useless, since the caller
> of this function already handles the failure properly.
because this function can return NULL in other codepath

> Remove it.
I don't know why this BUG() is there (and maybe it's not really
needed), but your rationale is wrong.

> Signed-off-by: WANG Cong <amwang@redhat.com>
> Cc: Alexander Viro <viro@zeniv.linux.org.uk>
> Cc: Jens Axboe <jens.axboe@oracle.com>
> Cc: Nick Piggin <npiggin@suse.de>
> Cc: "Theodore Ts'o" <tytso@mit.edu>
> 
> ---
> diff --git a/fs/buffer.c b/fs/buffer.c
> index 6fa5302..ac111d7 100644
> --- a/fs/buffer.c
> +++ b/fs/buffer.c
> @@ -1041,7 +1041,6 @@ grow_dev_page(struct block_device *bdev, sector_t block,
>  	return page;
>  
>  failed:
> -	BUG();
>  	unlock_page(page);
>  	page_cache_release(page);
>  	return NULL;
> --

  reply	other threads:[~2009-12-01 16:55 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-01  2:34 [Patch] fs: remove a useless BUG() Amerigo Wang
2009-12-01 16:55 ` Marcin Slusarz [this message]
2009-12-01 18:52   ` tytso
2009-12-02  8:52     ` Nick Piggin
2009-12-02  8:52       ` Nick Piggin
2009-12-02 22:14 ` Andrew Morton
2009-12-08 10:13   ` Cong Wang

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=20091201165440.GA2688@joi.lan \
    --to=marcin.slusarz@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=amwang@redhat.com \
    --cc=jens.axboe@oracle.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=npiggin@suse.de \
    --cc=tytso@mit.edu \
    --cc=viro@zeniv.linux.org.uk \
    /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.