Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754027AbbFSJcP (ORCPT ); Fri, 19 Jun 2015 05:32:15 -0400 Received: from www.linutronix.de ([62.245.132.108]:57211 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751602AbbFSJcD (ORCPT ); Fri, 19 Jun 2015 05:32:03 -0400 Date: Fri, 19 Jun 2015 11:32:03 +0200 (CEST) From: Thomas Gleixner To: Maninder Singh cc: Jason Cooper , LKML , pankaj.m@samsung.com, Marc Zyngier Subject: Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG In-Reply-To: <1434703938-19180-1-git-send-email-maninder1.s@samsung.com> Message-ID: References: <1434703938-19180-1-git-send-email-maninder1.s@samsung.com> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001,URIBL_BLOCKED=0.001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1489 Lines: 44 On Fri, 19 Jun 2015, Maninder Singh wrote: > Use BUG_ON(condition) instead of if(condition)/BUG() > As given in scripts/coccinelle/misc/bugon.cocci > > Signed-off-by: Maninder Singh > Reviewed-by: Vaneet Narang > --- > drivers/irqchip/irq-gic.c | 18 ++++++------------ > 1 file changed, 6 insertions(+), 12 deletions(-) > > diff --git a/drivers/irqchip/irq-gic.c b/drivers/irqchip/irq-gic.c > index 8d7e1c8..b222c7b 100644 > --- a/drivers/irqchip/irq-gic.c > +++ b/drivers/irqchip/irq-gic.c > @@ -329,8 +329,7 @@ static struct irq_chip gic_chip = { > > void __init gic_cascade_irq(unsigned int gic_nr, unsigned int irq) > { > - 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. 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? 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/