Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1168638 > unrolled thread
| Started by | Maninder Singh <maninder1.s@samsung.com> |
|---|---|
| First post | 2015-06-19 11:00 +0200 |
| Last post | 2015-06-19 11:40 +0200 |
| Articles | 2 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG Maninder Singh <maninder1.s@samsung.com> - 2015-06-19 11:00 +0200
Re: [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG Thomas Gleixner <tglx@linutronix.de> - 2015-06-19 11:40 +0200
| From | Maninder Singh <maninder1.s@samsung.com> |
|---|---|
| Date | 2015-06-19 11:00 +0200 |
| Subject | [PATCH 1/1] irq-gic: use BUG_ON instead of if()/BUG |
| Message-ID | <pD0jw-2sP-7@gated-at.bofh.it> |
Use BUG_ON(condition) instead of if(condition)/BUG()
As given in scripts/coccinelle/misc/bugon.cocci
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Reviewed-by: Vaneet Narang <v.narang@samsung.com>
---
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();
irq_set_chained_handler(irq, gic_handle_cascade_irq);
@@ -444,8 +443,7 @@ static void gic_dist_save(unsigned int gic_nr)
void __iomem *dist_base;
int i;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
gic_irqs = gic_data[gic_nr].gic_irqs;
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
@@ -479,8 +477,7 @@ static void gic_dist_restore(unsigned int gic_nr)
unsigned int i;
void __iomem *dist_base;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
gic_irqs = gic_data[gic_nr].gic_irqs;
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
@@ -516,8 +513,7 @@ static void gic_cpu_save(unsigned int gic_nr)
void __iomem *dist_base;
void __iomem *cpu_base;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
cpu_base = gic_data_cpu_base(&gic_data[gic_nr]);
@@ -542,8 +538,7 @@ static void gic_cpu_restore(unsigned int gic_nr)
void __iomem *dist_base;
void __iomem *cpu_base;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
cpu_base = gic_data_cpu_base(&gic_data[gic_nr]);
@@ -699,8 +694,7 @@ void gic_migrate_target(unsigned int new_cpu_id)
int i, ror_val, cpu = smp_processor_id();
u32 val, cur_target_mask, active_mask;
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
dist_base = gic_data_dist_base(&gic_data[gic_nr]);
if (!dist_base)
--
1.7.9.5
--
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]
| From | Thomas Gleixner <tglx@linutronix.de> |
|---|---|
| Date | 2015-06-19 11:40 +0200 |
| Message-ID | <pD0We-3qZ-15@gated-at.bofh.it> |
| In reply to | #1168638 |
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 <maninder1.s@samsung.com>
> Reviewed-by: Vaneet Narang <v.narang@samsung.com>
> ---
> 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/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web