From: Thomas Gleixner <tglx@linutronix.de>
To: Maninder Singh <maninder1.s@samsung.com>
Cc: Jason Cooper <jason@lakedaemon.net>,
LKML <linux-kernel@vger.kernel.org>,
PANKAJ MISHRA <pankaj.m@samsung.com>,
Marc Zyngier <marc.zyngier@arm.com>
Subject: Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG
Date: Fri, 19 Jun 2015 12:07:39 +0200 (CEST) [thread overview]
Message-ID: <alpine.DEB.2.11.1506191203420.4107@nanos> (raw)
In-Reply-To: <814009118.53061434707495088.JavaMail.weblogic@ep2mlwas07a>
On Fri, 19 Jun 2015, Maninder Singh wrote:
> Hi Thomas,
>
> >> {
> >> - if (gic_nr >= MAX_GIC_NR)
> >> - BUG();
> >> + BUG_ON(gic_nr >= MAX_GIC_NR);
> >> if (irq_set_handler_data(irq, &gic_data[gic_nr]) != 0)
> >> BUG();
> >
> >So this patch was clearly done just by running a script and not sanity
> >checked afterwards. Otherwise the next if() BUG(); construct would
> >have been fixed as well.
>
> Yes semantic patch did the changes to use preferred APIs,
> And it also changed this BUG_ON(irq_set_handler_data(irq, &gic_data[gic_nr]) != 0)
> But we have to take care that condition has no side effects i.e.
>
> if()/BUG conversion to BUG_ON must be avoided when there's side effect
> in condition. The reason being BUG_ON won't execute the condition when CONFIG_BUG
> is not defined As suggested by Julia Lawall
>
> Thats why did not take that change --> (BUG_ON(irq_set_handler_data(irq, &gic_data[gic_nr]) != 0))
Fair enough. But you should mention that in the changelog.
> >Further, while we are at that. It would be even more useful to analyze
> >whether the BUG_ON() is needed in the first place or at least could be
> >made conditional on some debug option.
> >
> >But that's not done by the script either, right?
>
> Yes coccinelle semantic patches did not do that changes.
> we have to choose whether to make BUG_ON conditional on some debug options.
Right, and that's what I'm asking for. IOW, instead of blindly running
scripts at least ask the question whether this stuff needs to be there
unconditionally....
Such information can be put into the changelog and helps the reviewers
to distinguish thoughtful people from script bots.
Thanks,
tglx
next prev parent reply other threads:[~2015-06-19 10:07 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-06-19 9:51 Maninder Singh
2015-06-19 10:07 ` Thomas Gleixner [this message]
-- strict thread matches above, loose matches on Subject: below --
2015-06-22 13:05 Maninder Singh
2015-06-19 8:52 Maninder Singh
2015-06-19 9:32 ` Thomas Gleixner
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=alpine.DEB.2.11.1506191203420.4107@nanos \
--to=tglx@linutronix.de \
--cc=jason@lakedaemon.net \
--cc=linux-kernel@vger.kernel.org \
--cc=maninder1.s@samsung.com \
--cc=marc.zyngier@arm.com \
--cc=pankaj.m@samsung.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®