From: Brian Norris <computersforpeace@gmail.com>
To: Julia Lawall <julia.lawall@lip6.fr>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>,
Amitoj Kaur Chawla <amitoj1606@gmail.com>,
David Woodhouse <dwmw2@infradead.org>,
"linux-mtd@lists.infradead.org" <linux-mtd@lists.infradead.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] mtd: Replace if and BUG with BUG_ON
Date: Sat, 9 Jul 2016 18:52:44 -0700 [thread overview]
Message-ID: <20160710015244.GB7547@localhost> (raw)
In-Reply-To: <alpine.DEB.2.02.1605310737170.2205@localhost6.localdomain6>
Hi,
On Tue, May 31, 2016 at 07:41:23AM +0200, Julia Lawall wrote:
> On Mon, 30 May 2016, Ezequiel Garcia wrote:
> > On 28 May 2016 at 13:41, Amitoj Kaur Chawla <amitoj1606@gmail.com> wrote:
> > > Replace if condition and BUG() with a BUG_ON having the conditional
> > > expression of the if statement as argument.
[...]
> > > diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
> > > index daf82ba..41b13d1 100644
> > > --- a/drivers/mtd/ssfdc.c
> > > +++ b/drivers/mtd/ssfdc.c
> > > @@ -380,8 +380,7 @@ static int ssfdcr_readsect(struct mtd_blktrans_dev *dev,
> > > " block_addr=%d\n", logic_sect_no, sectors_per_block, offset,
> > > block_address);
> > >
> > > - if (block_address >= ssfdc->map_len)
> > > - BUG();
> > > + BUG_ON(block_address >= ssfdc->map_len);
> > >
> >
> > I don't want to be rude, but I wonder if there's any value at all in
> > such a patch. It barely improves readability, it barely reduces the
> > LoC, yet it consumes developer time, maintainer time, and changes git
> > per-line authorship (used in git blame).
>
> Actually, I think that this particular patch does improve readability a
> bit. Scanning straight down the code is easier than looking under an if.
> Also, git blame now has a way to go back in history (although I don't
> remember what it is), so the argument that cleaning up the code makes it
> very difficult to find why the nontrivial part of the code is as it is
> doesn't completely hold any more.
I agree it's a small improvement. Not sure I'd worry too much about
git-blame. Applied to l2-mtd.git.
Brian
prev parent reply other threads:[~2016-07-10 1:53 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-05-28 16:41 [PATCH] mtd: Replace if and BUG with BUG_ON Amitoj Kaur Chawla
2016-05-30 22:19 ` Ezequiel Garcia
2016-05-31 5:41 ` Julia Lawall
2016-07-10 1:52 ` Brian Norris [this message]
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=20160710015244.GB7547@localhost \
--to=computersforpeace@gmail.com \
--cc=amitoj1606@gmail.com \
--cc=dwmw2@infradead.org \
--cc=ezequiel@vanguardiasur.com.ar \
--cc=julia.lawall@lip6.fr \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/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.