From mboxrd@z Thu Jan 1 00:00:00 1970 From: Marcin Slusarz Subject: Re: [Patch] fs: remove a useless BUG() Date: Tue, 1 Dec 2009 17:55:11 +0100 Message-ID: <20091201165440.GA2688@joi.lan> References: <20091201023714.3863.92566.sendpatchset@localhost.localdomain> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: linux-kernel@vger.kernel.org, Alexander Viro , Jens Axboe , Nick Piggin , linux-fsdevel@vger.kernel.org, akpm@linux-foundation.org, Theodore Ts'o To: Amerigo Wang Return-path: Received: from mail-bw0-f227.google.com ([209.85.218.227]:52335 "EHLO mail-bw0-f227.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754172AbZLAQza (ORCPT ); Tue, 1 Dec 2009 11:55:30 -0500 Content-Disposition: inline In-Reply-To: <20091201023714.3863.92566.sendpatchset@localhost.localdomain> Sender: linux-fsdevel-owner@vger.kernel.org List-ID: 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 > Cc: Alexander Viro > Cc: Jens Axboe > Cc: Nick Piggin > Cc: "Theodore Ts'o" > > --- > 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; > --