Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1168666 > unrolled thread

Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG

Started byManinder Singh <maninder1.s@samsung.com>
First post2015-06-19 12:00 +0200
Last post2015-06-19 12:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG Maninder Singh <maninder1.s@samsung.com> - 2015-06-19 12:00 +0200
    Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG Thomas Gleixner <tglx@linutronix.de> - 2015-06-19 12:10 +0200

#1168666 — Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG

FromManinder Singh <maninder1.s@samsung.com>
Date2015-06-19 12:00 +0200
SubjectRe: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG
Message-ID<pD1fB-3NZ-31@gated-at.bofh.it>
SGkgVGhvbWFzLA0KDQo+PiAgew0KPj4gLQlpZiAoZ2ljX25yID49IE1BWF9HSUNfTlIpDQo+PiAt
CQlCVUcoKTsNCj4+ICsJQlVHX09OKGdpY19uciA+PSBNQVhfR0lDX05SKTsNCj4+ICAJaWYgKGly
cV9zZXRfaGFuZGxlcl9kYXRhKGlycSwgJmdpY19kYXRhW2dpY19ucl0pICE9IDApDQo+PiAgCQlC
VUcoKTsNCj4NCj5TbyB0aGlzIHBhdGNoIHdhcyBjbGVhcmx5IGRvbmUganVzdCBieSBydW5uaW5n
IGEgc2NyaXB0IGFuZCBub3Qgc2FuaXR5DQo+Y2hlY2tlZCBhZnRlcndhcmRzLiBPdGhlcndpc2Ug
dGhlIG5leHQgaWYoKSBCVUcoKTsgY29uc3RydWN0IHdvdWxkDQo+aGF2ZSBiZWVuIGZpeGVkIGFz
IHdlbGwuDQoNClllcyBzZW1hbnRpYyBwYXRjaCBkaWQgdGhlIGNoYW5nZXMgdG8gdXNlIHByZWZl
cnJlZCBBU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G9vc2Ugd2hldGhlciB0
byBtYWtlIEJVR19PTiBjb25kaXRpb25hbCBvbiBzb21lIGRlYnVnIG9wdGlvbnMuDQoNClRoYW5r
cywNCk1hbmluZGVyDQoNCg0K


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1168670

FromThomas Gleixner <tglx@linutronix.de>
Date2015-06-19 12:10 +0200
Message-ID<pD1pf-4ew-11@gated-at.bofh.it>
In reply to#1168666
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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web