Received: from mail.onstor.com (66.201.51.107) by exch1.onstor.net
 (10.0.0.225) with Microsoft SMTP Server id 8.1.311.2; Wed, 11 Mar 2009
 12:19:14 -0700
Received: from psmtp.com ([64.18.0.46]) by mail.onstor.com with Microsoft
 SMTPSVC(6.0.3790.3959);	 Wed, 11 Mar 2009 12:19:13 -0700
Received: from source ([213.58.128.207]) by exprod5mx200.postini.com
 ([64.18.4.13]) with SMTP;	Wed, 11 Mar 2009 15:19:13 EDT
Received: from localhost.localdomain ([127.0.0.1]:63411 "EHLO
	ftp.linux-mips.org") by ftp.linux-mips.org with ESMTP	id S21365015AbZCKTSw
 (ORCPT <rfc822;andy.sharp@onstor.com>);	Wed, 11 Mar 2009 19:18:52 +0000
Received: with ECARTIS (v1.0.0; list linux-mips); Wed, 11 Mar 2009 19:18:35
 +0000 (GMT)
Received: from localhost.localdomain ([127.0.0.1]:59827 "EHLO
 h5.dl5rb.org.uk")	by ftp.linux-mips.org with ESMTP id S20808194AbZCKTSa
 (ORCPT	<rfc822;linux-mips@linux-mips.org>); Wed, 11 Mar 2009 19:18:30 +0000
Received: from h5.dl5rb.org.uk (localhost.localdomain [127.0.0.1])	by
 h5.dl5rb.org.uk (8.14.3/8.14.3) with ESMTP id n2BJIPMH005303;	Wed, 11 Mar
 2009 20:18:25 +0100
Received: (from ralf@localhost)	by h5.dl5rb.org.uk (8.14.3/8.14.3/Submit) id
 n2BJIENP005299;	Wed, 11 Mar 2009 20:18:14 +0100
From: Ralf Baechle <ralf@linux-mips.org>
To: Stoyan Gaydarov <stoyboyker@gmail.com>
CC: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-mips@linux-mips.org" <linux-mips@linux-mips.org>
Sender: "linux-mips-bounce@linux-mips.org" <linux-mips-bounce@linux-mips.org>
Date: Wed, 11 Mar 2009 12:18:14 -0700
Subject: Re: [PATCH 06/25] [mips] BUG to BUG_ON changes
Thread-Topic: [PATCH 06/25] [mips] BUG to BUG_ON changes
Thread-Index: AcmifkPyNrGvBR0GSvSvGeyollE2CQ==
Message-ID: <20090311191814.GA3112@linux-mips.org>
References: <1236661850-8237-1-git-send-email-stoyboyker@gmail.com>
 <1236661850-8237-2-git-send-email-stoyboyker@gmail.com>
 <1236661850-8237-3-git-send-email-stoyboyker@gmail.com>
 <1236661850-8237-4-git-send-email-stoyboyker@gmail.com>
 <1236661850-8237-5-git-send-email-stoyboyker@gmail.com>
 <1236661850-8237-6-git-send-email-stoyboyker@gmail.com>
 <1236661850-8237-7-git-send-email-stoyboyker@gmail.com>
In-Reply-To: <1236661850-8237-7-git-send-email-stoyboyker@gmail.com>
Accept-Language: en-US
Content-Language: en-US
X-MS-Exchange-Organization-AuthAs: Internal
X-MS-Exchange-Organization-AuthMechanism: 0b
X-MS-Exchange-Organization-AuthSource: exch1.onstor.net
X-MS-Has-Attach:
X-Auto-Response-Suppress: All
X-MS-TNEF-Correlator:
x-originalarrivaltime: 11 Mar 2009 19:19:13.0931 (UTC)
 FILETIME=[43879DB0:01C9A27E]
user-agent: Mutt/1.5.18 (2008-05-17)
errors-to: linux-mips-bounce@linux-mips.org
x-pstn-levels: (S:99.90000/99.90000 CV: 7.5468 FC:95.5390 LC:95.5390
 R:95.9108 P:95.9108 M:97.0282 C:98.6951 )
x-pstn-neptune: 0/0/0.00/0
x-ems-proccessed: 2K3Xl1OQTInXD6xxuA8z3Q==
x-ems-stamp: yrzKJzpLD1XXtsNjPkHMkg==
x-list: linux-mips
x-archive-position: 22061
x-ecartis-version: Ecartis v1.0.0
x-original-sender: ralf@linux-mips.org
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0

On Tue, Mar 10, 2009 at 12:10:31AM -0500, Stoyan Gaydarov wrote:

I wonder if this patch series was generated with
http://www.emn.fr/x-info/coccinelle/rules/bugon.html ?  That semantic
patch misses the same places that your patch is missing.  The patch below
should catch all occurances below arch/mips.

  Ralf

Signed-off-by: Ralf Baechle <ralf@linux-mips.org>

 arch/mips/jazz/jazzdma.c |    3 +--
 arch/mips/kernel/traps.c |    3 +--
 arch/mips/mm/highmem.c   |    9 +++------
 arch/mips/mm/init.c      |    3 +--
 arch/mips/mm/ioremap.c   |    9 +++------
 5 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/arch/mips/jazz/jazzdma.c b/arch/mips/jazz/jazzdma.c
index c672c08..f0fd636 100644
--- a/arch/mips/jazz/jazzdma.c
+++ b/arch/mips/jazz/jazzdma.c
@@ -68,8 +68,7 @@ static int __init vdma_init(void)
 	 */
 	pgtbl =3D (VDMA_PGTBL_ENTRY *)__get_free_pages(GFP_KERNEL | GFP_DMA,
 						    get_order(VDMA_PGTBL_SIZE));
-	if (!pgtbl)
-		BUG();
+	BUG_ON(!pgtbl);
 	dma_cache_wback_inv((unsigned long)pgtbl, VDMA_PGTBL_SIZE);
 	pgtbl =3D (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
=20
diff --git a/arch/mips/kernel/traps.c b/arch/mips/kernel/traps.c
index b2d7041..89956d5 100644
--- a/arch/mips/kernel/traps.c
+++ b/arch/mips/kernel/traps.c
@@ -1277,8 +1277,7 @@ static void *set_vi_srs_handler(int n, vi_handler_t a=
ddr, int srs)
 	u32 *w;
 	unsigned char *b;
=20
-	if (!cpu_has_veic && !cpu_has_vint)
-		BUG();
+	BUG_ON(!cpu_has_veic && !cpu_has_vint);
=20
 	if (addr =3D=3D NULL) {
 		handler =3D (unsigned long) do_default_vi;
diff --git a/arch/mips/mm/highmem.c b/arch/mips/mm/highmem.c
index 8f2cd8e..060d28d 100644
--- a/arch/mips/mm/highmem.c
+++ b/arch/mips/mm/highmem.c
@@ -17,8 +17,7 @@ void *__kmap(struct page *page)
=20
 void __kunmap(struct page *page)
 {
-	if (in_interrupt())
-		BUG();
+	BUG_ON(in_interrupt());
 	if (!PageHighMem(page))
 		return;
 	kunmap_high(page);
@@ -46,8 +45,7 @@ void *__kmap_atomic(struct page *page, enum km_type type)
 	idx =3D type + KM_TYPE_NR*smp_processor_id();
 	vaddr =3D __fix_to_virt(FIX_KMAP_BEGIN + idx);
 #ifdef CONFIG_DEBUG_HIGHMEM
-	if (!pte_none(*(kmap_pte-idx)))
-		BUG();
+	BUG_ON(!pte_none(*(kmap_pte - idx)));
 #endif
 	set_pte(kmap_pte-idx, mk_pte(page, kmap_prot));
 	local_flush_tlb_one((unsigned long)vaddr);
@@ -66,8 +64,7 @@ void __kunmap_atomic(void *kvaddr, enum km_type type)
 		return;
 	}
=20
-	if (vaddr !=3D __fix_to_virt(FIX_KMAP_BEGIN+idx))
-		BUG();
+	BUG_ON(vaddr !=3D __fix_to_virt(FIX_KMAP_BEGIN + idx));
=20
 	/*
 	 * force other mappings to Oops if they'll try to access
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 137c14b..d934894 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -307,8 +307,7 @@ void __init fixrange_init(unsigned long start, unsigned=
 long end,
 				if (pmd_none(*pmd)) {
 					pte =3D (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
 					set_pmd(pmd, __pmd((unsigned long)pte));
-					if (pte !=3D pte_offset_kernel(pmd, 0))
-						BUG();
+					BUG_ON(pte !=3D pte_offset_kernel(pmd, 0));
 				}
 				vaddr +=3D PMD_SIZE;
 			}
diff --git a/arch/mips/mm/ioremap.c b/arch/mips/mm/ioremap.c
index 59945b9..0c43248 100644
--- a/arch/mips/mm/ioremap.c
+++ b/arch/mips/mm/ioremap.c
@@ -27,8 +27,7 @@ static inline void remap_area_pte(pte_t * pte, unsigned l=
ong address,
 	end =3D address + size;
 	if (end > PMD_SIZE)
 		end =3D PMD_SIZE;
-	if (address >=3D end)
-		BUG();
+	BUG_ON(address >=3D end);
 	pfn =3D phys_addr >> PAGE_SHIFT;
 	do {
 		if (!pte_none(*pte)) {
@@ -52,8 +51,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned lo=
ng address,
 	if (end > PGDIR_SIZE)
 		end =3D PGDIR_SIZE;
 	phys_addr -=3D address;
-	if (address >=3D end)
-		BUG();
+	BUG_ON(address >=3D end);
 	do {
 		pte_t * pte =3D pte_alloc_kernel(pmd, address);
 		if (!pte)
@@ -75,8 +73,7 @@ static int remap_area_pages(unsigned long address, phys_t=
 phys_addr,
 	phys_addr -=3D address;
 	dir =3D pgd_offset(&init_mm, address);
 	flush_cache_all();
-	if (address >=3D end)
-		BUG();
+	BUG_ON(address >=3D end);
 	do {
 		pud_t *pud;
 		pmd_t *pmd;

