All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: integrator: use BUG_ON where possible
Date: Mon, 12 Nov 2012 20:44:13 +0000	[thread overview]
Message-ID: <201211122044.13663.arnd@arndb.de> (raw)
In-Reply-To: <1352406191-14303-6-git-send-email-sasha.levin@oracle.com>

On Thursday 08 November 2012, Sasha Levin wrote:
> Just use BUG_ON() instead of constructions such as:
> 
> 	if (...)
> 		BUG()
> 
> A simplified version of the semantic patch that makes this transformation
> is as follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e;
> @@
> - if (e) BUG();
> + BUG_ON(e);
> // </smpl>
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Linus Walleij is doing most of the integrator work these days, maybe he
wants to apply the patch.

Acked-by: Arnd Bergmann <arnd@arndb.de>

>  arch/arm/mach-integrator/pci_v3.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
> index bbeca59..85938de 100644
> --- a/arch/arm/mach-integrator/pci_v3.c
> +++ b/arch/arm/mach-integrator/pci_v3.c
> @@ -191,12 +191,9 @@ static void __iomem *v3_open_config_window(struct pci_bus *bus,
>  	/*
>  	 * Trap out illegal values
>  	 */
> -	if (offset > 255)
> -		BUG();
> -	if (busnr > 255)
> -		BUG();
> -	if (devfn > 255)
> -		BUG();
> +	BUG_ON(offset > 255);
> +	BUG_ON(busnr > 255);
> +	BUG_ON(devfn > 255);
>  
>  	if (busnr == 0) {
>  		int slot = PCI_SLOT(devfn);
> -- 
> 1.7.10.4
> 
> 

WARNING: multiple messages have this Message-ID (diff)
From: Arnd Bergmann <arnd@arndb.de>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: linux-kernel@vger.kernel.org,
	Russell King <linux@arm.linux.org.uk>,
	Rob Herring <rob.herring@calxeda.com>,
	Bjorn Helgaas <bhelgaas@google.com>,
	David Howells <dhowells@redhat.com>,
	linux-arm-kernel@lists.infradead.org,
	Linus Walleij <linus.walleij@stericsson.com>
Subject: Re: [PATCH] ARM: integrator: use BUG_ON where possible
Date: Mon, 12 Nov 2012 20:44:13 +0000	[thread overview]
Message-ID: <201211122044.13663.arnd@arndb.de> (raw)
In-Reply-To: <1352406191-14303-6-git-send-email-sasha.levin@oracle.com>

On Thursday 08 November 2012, Sasha Levin wrote:
> Just use BUG_ON() instead of constructions such as:
> 
> 	if (...)
> 		BUG()
> 
> A simplified version of the semantic patch that makes this transformation
> is as follows: (http://coccinelle.lip6.fr/)
> 
> // <smpl>
> @@
> expression e;
> @@
> - if (e) BUG();
> + BUG_ON(e);
> // </smpl>
> 
> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>

Linus Walleij is doing most of the integrator work these days, maybe he
wants to apply the patch.

Acked-by: Arnd Bergmann <arnd@arndb.de>

>  arch/arm/mach-integrator/pci_v3.c |    9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
> 
> diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
> index bbeca59..85938de 100644
> --- a/arch/arm/mach-integrator/pci_v3.c
> +++ b/arch/arm/mach-integrator/pci_v3.c
> @@ -191,12 +191,9 @@ static void __iomem *v3_open_config_window(struct pci_bus *bus,
>  	/*
>  	 * Trap out illegal values
>  	 */
> -	if (offset > 255)
> -		BUG();
> -	if (busnr > 255)
> -		BUG();
> -	if (devfn > 255)
> -		BUG();
> +	BUG_ON(offset > 255);
> +	BUG_ON(busnr > 255);
> +	BUG_ON(devfn > 255);
>  
>  	if (busnr == 0) {
>  		int slot = PCI_SLOT(devfn);
> -- 
> 1.7.10.4
> 
> 


  reply	other threads:[~2012-11-12 20:44 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 20:23 [PATCH] vmxnet3: convert BUG_ON(true) into a simple BUG() Sasha Levin
2012-11-08 20:23 ` [PATCH] alpha: use BUG_ON where possible Sasha Levin
2012-11-08 21:42   ` Jiri Kosina
2012-11-09 16:23     ` Sasha Levin
2012-11-12 14:43       ` Jiri Kosina
2012-11-12 15:03         ` Sasha Levin
2012-11-08 20:23 ` [PATCH] ARM: gic: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-08 20:23 ` [PATCH] ARM: kprobes: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-09  9:26   ` Jon Medhurst (Tixy)
2012-11-09  9:26     ` Jon Medhurst (Tixy)
2012-11-08 20:23 ` [PATCH] ARM: EXYNOS: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-12 15:12   ` Maarten Lankhorst
2012-11-12 15:12     ` Maarten Lankhorst
2012-11-12 15:23     ` Russell King - ARM Linux
2012-11-12 15:23       ` Russell King - ARM Linux
2012-11-12 15:52       ` Sasha Levin
2012-11-12 15:52         ` Sasha Levin
2012-11-12 15:25     ` Sasha Levin
2012-11-12 15:25       ` Sasha Levin
2012-11-08 20:23 ` [PATCH] ARM: integrator: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-12 20:44   ` Arnd Bergmann [this message]
2012-11-12 20:44     ` Arnd Bergmann
2012-11-17 18:41     ` Linus Walleij
2012-11-17 18:41       ` Linus Walleij
2012-11-08 20:23 ` [PATCH] ARM: OMAP1: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-12 23:21   ` Tony Lindgren
2012-11-12 23:21     ` Tony Lindgren
2012-11-08 20:23 ` [PATCH] ARM: dma: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-08 20:23 ` [PATCH] ARM: versatile: " Sasha Levin
2012-11-08 20:23   ` Sasha Levin
2012-11-09  6:02 ` [PATCH] vmxnet3: convert BUG_ON(true) into a simple BUG() Shreyas Bhatewara
2012-11-09 22:03   ` David Miller
2012-11-11 22:27 ` Ryan Mallon

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=201211122044.13663.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@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.