This set changes the majority of BUG usage inside ifs to BUG_ON
Stoyan Gaydarov (25):
[btrfs] BUG to BUG_ON changes
[staging] BUG to BUG_ON changes
[net] BUG to BUG_ON changes
[arm] BUG to BUG_ON changes
[ia64] BUG to BUG_ON changes
[mips] BUG to BUG_ON changes
[x86] BUG to BUG_ON changes
[sparc] BUG to BUG_ON changes
[s390] BUG to BUG_ON changes
[mn10300] BUG to BUG_ON changes
[alpha] BUG to BUG_ON changes
[frv] BUG to BUG_ON changes
[blackfin] BUG to BUG_ON changes
[mm] BUG to BUG_ON changes
[cris] BUG to BUG_ON changes
[m32r] BUG to BUG_ON changes
[parisc] BUG to BUG_ON changes
[xtensa] BUG to BUG_ON changes
[sysctl.c] BUG to BUG_ON changes
[scsi] BUG to BUG_ON changes
[afs] BUG to BUG_ON changes
[reiserfs] BUG to BUG_ON changes
[drivers/misc] BUG to BUG_ON changes
[crypto] BUG to BUG_ON changes
[drivers] BUG to BUG_ON changes
arch/alpha/kernel/pci_iommu.c | 15 +++++----------
arch/arm/common/gic.c | 9 +++------
arch/arm/mach-ebsa110/io.c | 24 ++++++++----------------
arch/arm/mach-integrator/pci_v3.c | 9 +++------
arch/arm/mach-rpc/dma.c | 3 +--
arch/arm/mach-versatile/pci.c | 9 +++------
arch/arm/mm/init.c | 3 +--
arch/blackfin/include/asm/pci.h | 22 ++++++----------------
arch/cris/mm/init.c | 3 +--
arch/frv/kernel/uaccess.c | 6 ++----
arch/frv/mb93090-mb00/pci-dma-nommu.c | 6 ++----
arch/frv/mb93090-mb00/pci-dma.c | 6 ++----
arch/ia64/kernel/module.c | 3 +--
arch/ia64/kernel/setup.c | 3 +--
arch/ia64/mm/init.c | 3 +--
arch/ia64/sn/kernel/io_common.c | 15 +++++----------
arch/ia64/sn/kernel/io_init.c | 12 ++++--------
arch/ia64/sn/kernel/setup.c | 3 +--
arch/ia64/sn/kernel/sn2/sn_hwperf.c | 6 ++----
arch/ia64/sn/pci/pcibr/pcibr_dma.c | 4 +---
arch/m32r/kernel/setup.c | 3 +--
arch/m32r/kernel/smp.c | 9 +++------
arch/mips/jazz/jazzdma.c | 3 +--
arch/mips/kernel/traps.c | 3 +--
arch/mips/mm/ioremap.c | 9 +++------
arch/mn10300/kernel/irq.c | 3 +--
arch/mn10300/mm/init.c | 3 +--
arch/mn10300/mm/misalignment.c | 3 +--
arch/parisc/kernel/pci-dma.c | 12 ++++--------
arch/s390/kernel/debug.c | 3 +--
arch/s390/kernel/setup.c | 3 +--
arch/sparc/kernel/traps_64.c | 3 +--
arch/sparc/lib/bitext.c | 17 +++++++----------
arch/sparc/mm/srmmu.c | 3 +--
arch/x86/kernel/cpu/common.c | 6 ++----
arch/x86/kernel/quirks.c | 3 +--
arch/x86/mach-voyager/voyager_smp.c | 6 ++----
arch/xtensa/kernel/pci-dma.c | 9 +++------
drivers/ata/pata_hpt366.c | 3 +--
drivers/base/iommu.c | 4 +---
drivers/crypto/ixp4xx_crypto.c | 4 +---
drivers/gpu/drm/i915/intel_fb.c | 6 ++----
drivers/misc/sgi-gru/grukservices.c | 3 +--
drivers/misc/sgi-gru/grumain.c | 3 +--
drivers/mtd/ssfdc.c | 3 +--
drivers/net/atl1e/atl1e_main.c | 3 +--
drivers/net/chelsio/sge.c | 3 +--
drivers/net/ixgb/ixgb_osdep.h | 2 +-
drivers/net/pppol2tp.c | 3 +--
drivers/net/wireless/ath9k/core.h | 6 +-----
drivers/s390/char/tape_3590.c | 3 +--
drivers/s390/char/tape_core.c | 6 ++----
drivers/s390/char/tape_std.c | 4 ++--
drivers/scsi/lpfc/lpfc_els.c | 3 +--
drivers/sh/intc.c | 3 +--
drivers/staging/comedi/drivers.c | 6 ++----
drivers/staging/otus/wwrap.c | 3 +--
drivers/staging/usbip/vhci_sysfs.c | 3 +--
drivers/staging/wlan-ng/hfa384x_usb.c | 4 +---
fs/afs/netdevices.c | 3 +--
fs/btrfs/ctree.c | 3 +--
fs/btrfs/extent-tree.c | 3 +--
fs/btrfs/free-space-cache.c | 3 +--
fs/btrfs/tree-log.c | 3 +--
include/asm-frv/pci.h | 7 ++-----
include/asm-mn10300/unit-asb2303/timex.h | 3 +--
include/asm-mn10300/unit-asb2305/timex.h | 3 +--
include/linux/reiserfs_fs.h | 3 +--
kernel/sysctl.c | 3 +--
mm/nommu.c | 15 +++++----------
70 files changed, 129 insertions(+), 263 deletions(-)
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
fs/btrfs/ctree.c | 3 +--
fs/btrfs/extent-tree.c | 3 +--
fs/btrfs/free-space-cache.c | 3 +--
fs/btrfs/tree-log.c | 3 +--
4 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
index 37f31b5..2c590b0 100644
--- a/fs/btrfs/ctree.c
+++ b/fs/btrfs/ctree.c
@@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_root
BUG_ON(!path->nodes[level]);
lower = path->nodes[level];
nritems = btrfs_header_nritems(lower);
- if (slot > nritems)
- BUG();
+ BUG_ON(slot > nritems);
if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root))
BUG();
if (slot != nritems) {
diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
index 9abf81f..0314ab6 100644
--- a/fs/btrfs/extent-tree.c
+++ b/fs/btrfs/extent-tree.c
@@ -672,8 +672,7 @@ static noinline int insert_extents(struct btrfs_trans_handle *trans,
keys+i, data_size+i, total-i);
BUG_ON(ret < 0);
- if (last && ret > 1)
- BUG();
+ BUG_ON(last && ret > 1);
leaf = path->nodes[0];
for (c = 0; c < ret; c++) {
diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
index d1e5f0e..b0c7661 100644
--- a/fs/btrfs/free-space-cache.c
+++ b/fs/btrfs/free-space-cache.c
@@ -267,8 +267,7 @@ static int __btrfs_add_free_space(struct btrfs_block_group_cache *block_group,
out:
if (ret) {
printk(KERN_ERR "btrfs: unable to add free space :%d\n", ret);
- if (ret == -EEXIST)
- BUG();
+ BUG_ON(ret == -EEXIST);
}
kfree(alloc_info);
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 9c462fb..2c892f6 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -1150,8 +1150,7 @@ insert:
ret = insert_one_name(trans, root, path, key->objectid, key->offset,
name, name_len, log_type, &log_key);
- if (ret && ret != -ENOENT)
- BUG();
+ BUG_ON(ret && ret != -ENOENT);
goto out;
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
drivers/staging/comedi/drivers.c | 6 ++----
drivers/staging/otus/wwrap.c | 3 +--
drivers/staging/usbip/vhci_sysfs.c | 3 +--
drivers/staging/wlan-ng/hfa384x_usb.c | 4 +---
4 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/staging/comedi/drivers.c b/drivers/staging/comedi/drivers.c
index 36a93b9..0b3a0f4 100644
--- a/drivers/staging/comedi/drivers.c
+++ b/drivers/staging/comedi/drivers.c
@@ -545,8 +545,7 @@ unsigned int comedi_buf_munge(comedi_async * async, unsigned int num_bytes)
if (s->munge == NULL || (async->cmd.flags & CMDF_RAWDATA)) {
async->munge_count += num_bytes;
- if ((int)(async->munge_count - async->buf_write_count) > 0)
- BUG();
+ BUG_ON((int)(async->munge_count - async->buf_write_count) > 0);
return num_bytes;
}
/* don't munge partial samples */
@@ -576,8 +575,7 @@ unsigned int comedi_buf_munge(comedi_async * async, unsigned int num_bytes)
async->munge_ptr %= async->prealloc_bufsz;
count += block_size;
}
- if ((int)(async->munge_count - async->buf_write_count) > 0)
- BUG();
+ BUG_ON((int)(async->munge_count - async->buf_write_count) > 0);
return count;
}
diff --git a/drivers/staging/otus/wwrap.c b/drivers/staging/otus/wwrap.c
index 1bb5f59..a2d1389 100644
--- a/drivers/staging/otus/wwrap.c
+++ b/drivers/staging/otus/wwrap.c
@@ -350,8 +350,7 @@ void zfLnxUsbDataIn_callback(urb_t *urb)
buf->len = 0;
#endif
- if ((buf->tail + urb->actual_length) > buf->end)
- BUG();
+ BUG_ON((buf->tail + urb->actual_length) > buf->end);
skb_put(buf, urb->actual_length);
diff --git a/drivers/staging/usbip/vhci_sysfs.c b/drivers/staging/usbip/vhci_sysfs.c
index 0fd33a6..e4c7143 100644
--- a/drivers/staging/usbip/vhci_sysfs.c
+++ b/drivers/staging/usbip/vhci_sysfs.c
@@ -31,8 +31,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr,
char *s = out;
int i = 0;
- if (!the_controller || !out)
- BUG();
+ BUG_ON(!the_controller || !out);
spin_lock(&the_controller->lock);
diff --git a/drivers/staging/wlan-ng/hfa384x_usb.c b/drivers/staging/wlan-ng/hfa384x_usb.c
index 8a75b50..7cb3825 100644
--- a/drivers/staging/wlan-ng/hfa384x_usb.c
+++ b/drivers/staging/wlan-ng/hfa384x_usb.c
@@ -3612,9 +3612,7 @@ static void hfa384x_usbin_callback(struct urb *urb)
goto exit;
skb = hw->rx_urb_skb;
- if (!skb || (skb->data != urb->transfer_buffer)) {
- BUG();
- }
+ BUG_ON(!skb || (skb->data != urb->transfer_buffer));
hw->rx_urb_skb = NULL;
/* Check for error conditions within the URB */
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
drivers/net/atl1e/atl1e_main.c | 3 +--
drivers/net/chelsio/sge.c | 3 +--
drivers/net/ixgb/ixgb_osdep.h | 2 +-
drivers/net/pppol2tp.c | 3 +--
drivers/net/wireless/ath9k/core.h | 6 +-----
5 files changed, 5 insertions(+), 12 deletions(-)
diff --git a/drivers/net/atl1e/atl1e_main.c b/drivers/net/atl1e/atl1e_main.c
index bb9094d..d089550 100644
--- a/drivers/net/atl1e/atl1e_main.c
+++ b/drivers/net/atl1e/atl1e_main.c
@@ -1794,8 +1794,7 @@ static void atl1e_tx_map(struct atl1e_adapter *adapter,
memcpy(use_tpd, tpd, sizeof(struct atl1e_tpd_desc));
tx_buffer = atl1e_get_tx_buffer(adapter, use_tpd);
- if (tx_buffer->skb)
- BUG();
+ BUG_ON(tx_buffer->skb);
tx_buffer->skb = NULL;
tx_buffer->length =
diff --git a/drivers/net/chelsio/sge.c b/drivers/net/chelsio/sge.c
index d984b79..e60f610 100644
--- a/drivers/net/chelsio/sge.c
+++ b/drivers/net/chelsio/sge.c
@@ -1149,8 +1149,7 @@ static inline void write_tx_desc(struct cmdQ_e *e, dma_addr_t mapping,
unsigned int len, unsigned int gen,
unsigned int eop)
{
- if (unlikely(len > SGE_TX_DESC_MAX_PLEN))
- BUG();
+ BUG_ON(len > SGE_TX_DESC_MAX_PLEN);
e->addr_lo = (u32)mapping;
e->addr_hi = (u64)mapping >> 32;
e->len_gen = V_CMD_LEN(len) | V_CMD_GEN1(gen);
diff --git a/drivers/net/ixgb/ixgb_osdep.h b/drivers/net/ixgb/ixgb_osdep.h
index d92e72b..371a6be 100644
--- a/drivers/net/ixgb/ixgb_osdep.h
+++ b/drivers/net/ixgb/ixgb_osdep.h
@@ -40,7 +40,7 @@
#include <linux/sched.h>
#undef ASSERT
-#define ASSERT(x) if (!(x)) BUG()
+#define ASSERT(x) BUG_ON(!(x))
#define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B)
#ifdef DBG
diff --git a/drivers/net/pppol2tp.c b/drivers/net/pppol2tp.c
index f1a9467..97959b3 100644
--- a/drivers/net/pppol2tp.c
+++ b/drivers/net/pppol2tp.c
@@ -1222,8 +1222,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)
struct pppol2tp_session *session;
struct sock *sk;
- if (tunnel == NULL)
- BUG();
+ BUG_ON(tunnel == NULL);
PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
"%s: closing all sessions...\n", tunnel->name);
diff --git a/drivers/net/wireless/ath9k/core.h b/drivers/net/wireless/ath9k/core.h
index 4ca2aed..d310c68 100644
--- a/drivers/net/wireless/ath9k/core.h
+++ b/drivers/net/wireless/ath9k/core.h
@@ -52,11 +52,7 @@ struct ath_node;
#define A_MAX(a, b) ((a) > (b) ? (a) : (b))
-#define ASSERT(exp) do { \
- if (unlikely(!(exp))) { \
- BUG(); \
- } \
- } while (0)
+#define ASSERT(exp) BUG_ON(!(exp));
#define TSF_TO_TU(_h,_l) \
((((u32)(_h)) << 22) | (((u32)(_l)) >> 10))
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/ia64/kernel/module.c | 3 +--
arch/ia64/kernel/setup.c | 3 +--
arch/ia64/mm/init.c | 3 +--
arch/ia64/sn/kernel/io_common.c | 15 +++++----------
arch/ia64/sn/kernel/io_init.c | 12 ++++--------
arch/ia64/sn/kernel/setup.c | 3 +--
arch/ia64/sn/kernel/sn2/sn_hwperf.c | 6 ++----
arch/ia64/sn/pci/pcibr/pcibr_dma.c | 4 +---
8 files changed, 16 insertions(+), 33 deletions(-)
diff --git a/arch/ia64/kernel/module.c b/arch/ia64/kernel/module.c
index aaa7d90..19f5ce6 100644
--- a/arch/ia64/kernel/module.c
+++ b/arch/ia64/kernel/module.c
@@ -525,8 +525,7 @@ get_ltoff (struct module *mod, uint64_t value, int *okp)
goto found;
/* Not enough GOT entries? */
- if (e >= (struct got_entry *) (mod->arch.got->sh_addr + mod->arch.got->sh_size))
- BUG();
+ BUG_ON(e >= (struct got_entry *) (mod->arch.got->sh_addr + mod->arch.got->sh_size));
e->val = value;
++mod->arch.next_got_entry;
diff --git a/arch/ia64/kernel/setup.c b/arch/ia64/kernel/setup.c
index 865af27..97b0f37 100644
--- a/arch/ia64/kernel/setup.c
+++ b/arch/ia64/kernel/setup.c
@@ -1016,8 +1016,7 @@ cpu_init (void)
| IA64_DCR_DA | IA64_DCR_DD | IA64_DCR_LC));
atomic_inc(&init_mm.mm_count);
current->active_mm = &init_mm;
- if (current->mm)
- BUG();
+ BUG_ON(current->mm);
ia64_mmu_init(ia64_imva(cpu_data));
ia64_mca_cpu_init(ia64_imva(cpu_data));
diff --git a/arch/ia64/mm/init.c b/arch/ia64/mm/init.c
index 56e1290..1e8efb1 100644
--- a/arch/ia64/mm/init.c
+++ b/arch/ia64/mm/init.c
@@ -633,8 +633,7 @@ mem_init (void)
#endif
#ifdef CONFIG_FLATMEM
- if (!mem_map)
- BUG();
+ BUG_ON(!mem_map);
max_mapnr = max_low_pfn;
#endif
diff --git a/arch/ia64/sn/kernel/io_common.c b/arch/ia64/sn/kernel/io_common.c
index 0d4ffa4..57f280d 100644
--- a/arch/ia64/sn/kernel/io_common.c
+++ b/arch/ia64/sn/kernel/io_common.c
@@ -135,8 +135,7 @@ static s64 sn_device_fixup_war(u64 nasid, u64 widget, int device,
}
war_list = kzalloc(DEV_PER_WIDGET * sizeof(*war_list), GFP_KERNEL);
- if (!war_list)
- BUG();
+ BUG_ON(!war_list);
SAL_CALL_NOLOCK(isrv, SN_SAL_IOIF_GET_WIDGET_DMAFLUSH_LIST,
nasid, widget, __pa(war_list), 0, 0, 0 ,0);
@@ -180,23 +179,20 @@ sn_common_hubdev_init(struct hubdev_info *hubdev)
sizeof(struct sn_flush_device_kernel *);
hubdev->hdi_flush_nasid_list.widget_p =
kzalloc(size, GFP_KERNEL);
- if (!hubdev->hdi_flush_nasid_list.widget_p)
- BUG();
+ BUG_ON(!hubdev->hdi_flush_nasid_list.widget_p);
for (widget = 0; widget <= HUB_WIDGET_ID_MAX; widget++) {
size = DEV_PER_WIDGET *
sizeof(struct sn_flush_device_kernel);
sn_flush_device_kernel = kzalloc(size, GFP_KERNEL);
- if (!sn_flush_device_kernel)
- BUG();
+ BUG_ON(!sn_flush_device_kernel);
dev_entry = sn_flush_device_kernel;
for (device = 0; device < DEV_PER_WIDGET;
device++, dev_entry++) {
size = sizeof(struct sn_flush_device_common);
dev_entry->common = kzalloc(size, GFP_KERNEL);
- if (!dev_entry->common)
- BUG();
+ BUG_ON(!dev_entry->common);
if (sn_prom_feature_available(PRF_DEVICE_FLUSH_LIST))
status = sal_get_device_dmaflush_list(
hubdev->hdi_nasid, widget, device,
@@ -326,8 +322,7 @@ sn_common_bus_fixup(struct pci_bus *bus,
*/
controller->platform_data = kzalloc(sizeof(struct sn_platform_data),
GFP_KERNEL);
- if (controller->platform_data == NULL)
- BUG();
+ BUG_ON(controller->platform_data == NULL);
sn_platform_data =
(struct sn_platform_data *) controller->platform_data;
sn_platform_data->provider_soft = provider_soft;
diff --git a/arch/ia64/sn/kernel/io_init.c b/arch/ia64/sn/kernel/io_init.c
index e2eb2da..ee774c3 100644
--- a/arch/ia64/sn/kernel/io_init.c
+++ b/arch/ia64/sn/kernel/io_init.c
@@ -128,8 +128,7 @@ sn_legacy_pci_window_fixup(struct pci_controller *controller,
{
controller->window = kcalloc(2, sizeof(struct pci_window),
GFP_KERNEL);
- if (controller->window == NULL)
- BUG();
+ BUG_ON(controller->window == NULL);
controller->window[0].offset = legacy_io;
controller->window[0].resource.name = "legacy_io";
controller->window[0].resource.flags = IORESOURCE_IO;
@@ -168,8 +167,7 @@ sn_pci_window_fixup(struct pci_dev *dev, unsigned int count,
idx = controller->windows;
new_count = controller->windows + count;
new_window = kcalloc(new_count, sizeof(struct pci_window), GFP_KERNEL);
- if (new_window == NULL)
- BUG();
+ BUG_ON(new_window == NULL);
if (controller->window) {
memcpy(new_window, controller->window,
sizeof(struct pci_window) * controller->windows);
@@ -222,8 +220,7 @@ sn_io_slot_fixup(struct pci_dev *dev)
(u64) __pa(pcidev_info),
(u64) __pa(sn_irq_info));
- if (status)
- BUG(); /* Cannot get platform pci device information */
+ BUG_ON(status); /* Cannot get platform pci device information */
/* Copy over PIO Mapped Addresses */
@@ -307,8 +304,7 @@ sn_pci_controller_fixup(int segment, int busnum, struct pci_bus *bus)
prom_bussoft_ptr = __va(prom_bussoft_ptr);
controller = kzalloc(sizeof(*controller), GFP_KERNEL);
- if (!controller)
- BUG();
+ BUG_ON(!controller);
controller->segment = segment;
/*
diff --git a/arch/ia64/sn/kernel/setup.c b/arch/ia64/sn/kernel/setup.c
index 02c5b8a..edbf168 100644
--- a/arch/ia64/sn/kernel/setup.c
+++ b/arch/ia64/sn/kernel/setup.c
@@ -732,8 +732,7 @@ void __init build_cnode_tables(void)
kl_config_hdr_t *klgraph_header;
nasid = cnodeid_to_nasid(node);
klgraph_header = ia64_sn_get_klconfig_addr(nasid);
- if (klgraph_header == NULL)
- BUG();
+ BUG_ON(klgraph_header == NULL);
brd = NODE_OFFSET_TO_LBOARD(nasid, klgraph_header->ch_board_info);
while (brd) {
if (board_needs_cnode(brd->brd_type) && physical_node_map[brd->brd_nasid] < 0) {
diff --git a/arch/ia64/sn/kernel/sn2/sn_hwperf.c b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
index be33947..2ae6d3f 100644
--- a/arch/ia64/sn/kernel/sn2/sn_hwperf.c
+++ b/arch/ia64/sn/kernel/sn2/sn_hwperf.c
@@ -275,8 +275,7 @@ static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objb
/* get it's interconnect topology */
sz = op->ports * sizeof(struct sn_hwperf_port_info);
- if (sz > sizeof(ptdata))
- BUG();
+ BUG_ON(sz > sizeof(ptdata));
e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
SN_HWPERF_ENUM_PORTS, nodeobj->id, sz,
(u64)&ptdata, 0, 0, NULL);
@@ -310,8 +309,7 @@ static int sn_hwperf_get_nearest_node_objdata(struct sn_hwperf_object_info *objb
if (router && (!found_cpu || !found_mem)) {
/* search for a node connected to the same router */
sz = router->ports * sizeof(struct sn_hwperf_port_info);
- if (sz > sizeof(ptdata))
- BUG();
+ BUG_ON(sz > sizeof(ptdata));
e = ia64_sn_hwperf_op(sn_hwperf_master_nasid,
SN_HWPERF_ENUM_PORTS, router->id, sz,
(u64)&ptdata, 0, 0, NULL);
diff --git a/arch/ia64/sn/pci/pcibr/pcibr_dma.c b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
index 060df4a..c659ad5 100644
--- a/arch/ia64/sn/pci/pcibr/pcibr_dma.c
+++ b/arch/ia64/sn/pci/pcibr/pcibr_dma.c
@@ -256,9 +256,7 @@ void sn_dma_flush(u64 addr)
hubinfo = (NODEPDA(nasid_to_cnodeid(nasid)))->pdinfo;
- if (!hubinfo) {
- BUG();
- }
+ BUG_ON(!hubinfo);
flush_nasid_list = &hubinfo->hdi_flush_nasid_list;
if (flush_nasid_list->widget_p == NULL)
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/mips/jazz/jazzdma.c | 3 +--
arch/mips/kernel/traps.c | 3 +--
arch/mips/mm/ioremap.c | 9 +++------
3 files changed, 5 insertions(+), 10 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 = (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 = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
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 addr, int srs)
u32 *w;
unsigned char *b;
- if (!cpu_has_veic && !cpu_has_vint)
- BUG();
+ BUG_ON(!cpu_has_veic && !cpu_has_vint);
if (addr == NULL) {
handler = (unsigned long) do_default_vi;
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 long address,
end = address + size;
if (end > PMD_SIZE)
end = PMD_SIZE;
- if (address >= end)
- BUG();
+ BUG_ON(address >= end);
pfn = phys_addr >> PAGE_SHIFT;
do {
if (!pte_none(*pte)) {
@@ -52,8 +51,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address,
if (end > PGDIR_SIZE)
end = PGDIR_SIZE;
phys_addr -= address;
- if (address >= end)
- BUG();
+ BUG_ON(address >= end);
do {
pte_t * pte = 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 -= address;
dir = pgd_offset(&init_mm, address);
flush_cache_all();
- if (address >= end)
- BUG();
+ BUG_ON(address >= end);
do {
pud_t *pud;
pmd_t *pmd;
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/arm/common/gic.c | 9 +++------
arch/arm/mach-ebsa110/io.c | 24 ++++++++----------------
arch/arm/mach-integrator/pci_v3.c | 9 +++------
arch/arm/mach-rpc/dma.c | 3 +--
arch/arm/mach-versatile/pci.c | 9 +++------
arch/arm/mm/init.c | 3 +--
6 files changed, 19 insertions(+), 38 deletions(-)
diff --git a/arch/arm/common/gic.c b/arch/arm/common/gic.c
index c6884ba..3b230a7 100644
--- a/arch/arm/common/gic.c
+++ b/arch/arm/common/gic.c
@@ -166,8 +166,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 (set_irq_data(irq, &gic_data[gic_nr]) != 0)
BUG();
set_irq_chained_handler(irq, gic_handle_cascade_irq);
@@ -179,8 +178,7 @@ void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,
unsigned int max_irq, i;
u32 cpumask = 1 << smp_processor_id();
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
cpumask |= cpumask << 8;
cpumask |= cpumask << 16;
@@ -243,8 +241,7 @@ void __init gic_dist_init(unsigned int gic_nr, void __iomem *base,
void __cpuinit gic_cpu_init(unsigned int gic_nr, void __iomem *base)
{
- if (gic_nr >= MAX_GIC_NR)
- BUG();
+ BUG_ON(gic_nr >= MAX_GIC_NR);
gic_data[gic_nr].cpu_base = base;
diff --git a/arch/arm/mach-ebsa110/io.c b/arch/arm/mach-ebsa110/io.c
index c52e304..0a6ec5b 100644
--- a/arch/arm/mach-ebsa110/io.c
+++ b/arch/arm/mach-ebsa110/io.c
@@ -79,8 +79,7 @@ u16 __readw(const volatile void __iomem *addr)
{
void __iomem *a = __isamem_convert_addr(addr);
- if ((unsigned long)addr & 1)
- BUG();
+ BUG_ON((unsigned long)addr & 1);
return __raw_readw(a);
}
@@ -90,8 +89,7 @@ u32 __readl(const volatile void __iomem *addr)
void __iomem *a = __isamem_convert_addr(addr);
u32 ret;
- if ((unsigned long)addr & 3)
- BUG();
+ BUG_ON((unsigned long)addr & 3);
ret = __raw_readw(a);
ret |= __raw_readw(a + 4) << 16;
@@ -136,8 +134,7 @@ void __writew(u16 val, void __iomem *addr)
{
void __iomem *a = __isamem_convert_addr(addr);
- if ((unsigned long)addr & 1)
- BUG();
+ BUG_ON((unsigned long)addr & 1);
__raw_writew(val, a);
}
@@ -146,8 +143,7 @@ void __writel(u32 val, void __iomem *addr)
{
void __iomem *a = __isamem_convert_addr(addr);
- if ((unsigned long)addr & 3)
- BUG();
+ BUG_ON((unsigned long)addr & 3);
__raw_writew(val, a);
__raw_writew(val >> 16, a + 4);
@@ -333,8 +329,7 @@ void outsb(unsigned int port, const void *from, int len)
off = port << 2;
else {
off = (port & ~1) << 1;
- if (port & 1)
- BUG();
+ BUG_ON(port & 1);
}
__raw_writesb((void __iomem *)ISAIO_BASE + off, from, len);
@@ -348,8 +343,7 @@ void insb(unsigned int port, void *from, int len)
off = port << 2;
else {
off = (port & ~1) << 1;
- if (port & 1)
- BUG();
+ BUG_ON(port & 1);
}
__raw_readsb((void __iomem *)ISAIO_BASE + off, from, len);
@@ -366,8 +360,7 @@ void outsw(unsigned int port, const void *from, int len)
off = port << 2;
else {
off = (port & ~1) << 1;
- if (port & 1)
- BUG();
+ BUG_ON(port & 1);
}
__raw_writesw((void __iomem *)ISAIO_BASE + off, from, len);
@@ -381,8 +374,7 @@ void insw(unsigned int port, void *from, int len)
off = port << 2;
else {
off = (port & ~1) << 1;
- if (port & 1)
- BUG();
+ BUG_ON(port & 1);
}
__raw_readsw((void __iomem *)ISAIO_BASE + off, from, len);
diff --git a/arch/arm/mach-integrator/pci_v3.c b/arch/arm/mach-integrator/pci_v3.c
index f1d72b2..f8514fb 100644
--- a/arch/arm/mach-integrator/pci_v3.c
+++ b/arch/arm/mach-integrator/pci_v3.c
@@ -190,12 +190,9 @@ static unsigned long 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);
diff --git a/arch/arm/mach-rpc/dma.c b/arch/arm/mach-rpc/dma.c
index 7958a30..3fc0232 100644
--- a/arch/arm/mach-rpc/dma.c
+++ b/arch/arm/mach-rpc/dma.c
@@ -242,8 +242,7 @@ static void floppy_enable_dma(dmach_t channel, dma_t *dma)
unsigned int fiqhandler_length;
struct pt_regs regs;
- if (dma->sg)
- BUG();
+ BUG_ON(dma->sg);
if (dma->dma_mode == DMA_MODE_READ) {
extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
diff --git a/arch/arm/mach-versatile/pci.c b/arch/arm/mach-versatile/pci.c
index 7161ba2..ba910ab 100644
--- a/arch/arm/mach-versatile/pci.c
+++ b/arch/arm/mach-versatile/pci.c
@@ -84,12 +84,9 @@ static void __iomem *__pci_addr(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);
return VERSATILE_PCI_CFG_VIRT_BASE + ((busnr << 16) |
(PCI_SLOT(devfn) << 11) | (PCI_FUNC(devfn) << 8) | offset);
diff --git a/arch/arm/mm/init.c b/arch/arm/mm/init.c
index 34df4d9..67eba64 100644
--- a/arch/arm/mm/init.c
+++ b/arch/arm/mm/init.c
@@ -155,8 +155,7 @@ find_bootmap_pfn(int node, struct meminfo *mi, unsigned int bootmap_pages)
}
}
- if (bootmap_pfn == 0)
- BUG();
+ BUG_ON(bootmap_pfn == 0);
return bootmap_pfn;
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/x86/kernel/cpu/common.c | 6 ++----
arch/x86/kernel/quirks.c | 3 +--
arch/x86/mach-voyager/voyager_smp.c | 6 ++----
3 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 83492b1..86206c6 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1051,8 +1051,7 @@ void __cpuinit cpu_init(void)
atomic_inc(&init_mm.mm_count);
me->active_mm = &init_mm;
- if (me->mm)
- BUG();
+ BUG_ON(me->mm);
enter_lazy_tlb(&init_mm, me);
load_sp0(t, ¤t->thread);
@@ -1121,8 +1120,7 @@ void __cpuinit cpu_init(void)
*/
atomic_inc(&init_mm.mm_count);
curr->active_mm = &init_mm;
- if (curr->mm)
- BUG();
+ BUG_ON(curr->mm);
enter_lazy_tlb(&init_mm, curr);
load_sp0(t, thread);
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 309949e..6a5a297 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -74,8 +74,7 @@ static void ich_force_hpet_resume(void)
if (!force_hpet_address)
return;
- if (rcba_base == NULL)
- BUG();
+ BUG_ON(rcba_base == NULL);
/* read the Function Disable register, dword mode only */
val = readl(rcba_base + 0x3404);
diff --git a/arch/x86/mach-voyager/voyager_smp.c b/arch/x86/mach-voyager/voyager_smp.c
index b9cc84a..1a35fe1 100644
--- a/arch/x86/mach-voyager/voyager_smp.c
+++ b/arch/x86/mach-voyager/voyager_smp.c
@@ -825,14 +825,12 @@ voyager_flush_tlb_others(unsigned long cpumask, struct mm_struct *mm,
{
int stuck = 50000;
- if (!cpumask)
- BUG();
+ BUG_ON(!cpumask);
if ((cpumask & cpus_addr(cpu_online_map)[0]) != cpumask)
BUG();
if (cpumask & (1 << smp_processor_id()))
BUG();
- if (!mm)
- BUG();
+ BUG_ON(!mm);
spin_lock(&tlbstate_lock);
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/sparc/kernel/traps_64.c | 3 +--
arch/sparc/lib/bitext.c | 17 +++++++----------
arch/sparc/mm/srmmu.c | 3 +--
3 files changed, 9 insertions(+), 14 deletions(-)
diff --git a/arch/sparc/kernel/traps_64.c b/arch/sparc/kernel/traps_64.c
index d809c4e..5cd6b4c 100644
--- a/arch/sparc/kernel/traps_64.c
+++ b/arch/sparc/kernel/traps_64.c
@@ -366,8 +366,7 @@ static void spitfire_clean_and_reenable_l1_caches(void)
{
unsigned long va;
- if (tlb_type != spitfire)
- BUG();
+ BUG_ON(tlb_type != spitfire);
/* Clean 'em. */
for (va = 0; va < (PAGE_SIZE << 1); va += 32) {
diff --git a/arch/sparc/lib/bitext.c b/arch/sparc/lib/bitext.c
index 764b3eb..bc1007e 100644
--- a/arch/sparc/lib/bitext.c
+++ b/arch/sparc/lib/bitext.c
@@ -41,12 +41,11 @@ int bit_map_string_get(struct bit_map *t, int len, int align)
align = 1;
}
align1 = align - 1;
- if ((align & align1) != 0)
- BUG();
- if (align < 0 || align >= t->size)
- BUG();
- if (len <= 0 || len > t->size)
- BUG();
+
+ BUG_ON((align & align1) != 0);
+ BUG_ON(align < 0 || align >= t->size);
+ BUG_ON(len <= 0 || len > t->size);
+
color &= align1;
spin_lock(&t->lock);
@@ -104,8 +103,7 @@ void bit_map_clear(struct bit_map *t, int offset, int len)
{
int i;
- if (t->used < len)
- BUG(); /* Much too late to do any good, but alas... */
+ BUG_ON(t->used < len); /* Much too late to do any good, but alas... */
spin_lock(&t->lock);
for (i = 0; i < len; i++) {
if (test_bit(offset + i, t->map) == 0)
@@ -121,8 +119,7 @@ void bit_map_clear(struct bit_map *t, int offset, int len)
void bit_map_init(struct bit_map *t, unsigned long *map, int size)
{
- if ((size & 07) != 0)
- BUG();
+ BUG_ON((size & 07) != 0);
memset(map, 0, size>>3);
memset(t, 0, sizeof *t);
diff --git a/arch/sparc/mm/srmmu.c b/arch/sparc/mm/srmmu.c
index fe7ed08..5ea4dab 100644
--- a/arch/sparc/mm/srmmu.c
+++ b/arch/sparc/mm/srmmu.c
@@ -513,8 +513,7 @@ static void srmmu_pte_free(pgtable_t pte)
pgtable_page_dtor(pte);
p = (unsigned long)page_address(pte); /* Cached address (for test) */
- if (p == 0)
- BUG();
+ BUG_ON(p == 0);
p = page_to_pfn(pte) << PAGE_SHIFT; /* Physical address */
p = (unsigned long) __nocache_va(p); /* Nocached virtual */
srmmu_free_nocache(p, PTE_SIZE);
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/mn10300/kernel/irq.c | 3 +--
arch/mn10300/mm/init.c | 3 +--
arch/mn10300/mm/misalignment.c | 3 +--
include/asm-mn10300/unit-asb2303/timex.h | 3 +--
include/asm-mn10300/unit-asb2305/timex.h | 3 +--
5 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/arch/mn10300/kernel/irq.c b/arch/mn10300/kernel/irq.c
index 56c64cc..52b528e 100644
--- a/arch/mn10300/kernel/irq.c
+++ b/arch/mn10300/kernel/irq.c
@@ -159,8 +159,7 @@ asmlinkage void do_IRQ(void)
int irq;
sp = current_stack_pointer();
- if (sp - (sp & ~(THREAD_SIZE - 1)) < STACK_WARN)
- BUG();
+ BUG_ON(sp - (sp & ~(THREAD_SIZE - 1)) < STACK_WARN);
/* make sure local_irq_enable() doesn't muck up the interrupt priority
* setting in EPSW */
diff --git a/arch/mn10300/mm/init.c b/arch/mn10300/mm/init.c
index 8cee387..ea05781 100644
--- a/arch/mn10300/mm/init.c
+++ b/arch/mn10300/mm/init.c
@@ -84,8 +84,7 @@ void __init mem_init(void)
int codesize, reservedpages, datasize, initsize;
int tmp;
- if (!mem_map)
- BUG();
+ BUG_ON(!mem_map);
#define START_PFN (contig_page_data.bdata->node_min_pfn)
#define MAX_LOW_PFN (contig_page_data.bdata->node_low_pfn)
diff --git a/arch/mn10300/mm/misalignment.c b/arch/mn10300/mm/misalignment.c
index 94c4a43..eb1a290 100644
--- a/arch/mn10300/mm/misalignment.c
+++ b/arch/mn10300/mm/misalignment.c
@@ -450,8 +450,7 @@ found_opcode:
regs->pc, opcode, pop->opcode, pop->params[0], pop->params[1]);
tmp = format_tbl[pop->format].opsz;
- if (tmp > noc)
- BUG(); /* match was less complete than it ought to have been */
+ BUG_ON(tmp > noc); /* match was less complete than it ought to have been */
if (tmp < noc) {
tmp = noc - tmp;
diff --git a/include/asm-mn10300/unit-asb2303/timex.h b/include/asm-mn10300/unit-asb2303/timex.h
index 7e54b0c..4bf620e 100644
--- a/include/asm-mn10300/unit-asb2303/timex.h
+++ b/include/asm-mn10300/unit-asb2303/timex.h
@@ -50,8 +50,7 @@ static inline void startup_jiffies_counter(void)
md = TM0MD_SRC_IOCLK_32;
rate = MN10300_JCCLK / 32 / HZ;
- if (rate > TMJCBR_MAX)
- BUG();
+ BUG_ON(rate > TMJCBR_MAX);
}
}
diff --git a/include/asm-mn10300/unit-asb2305/timex.h b/include/asm-mn10300/unit-asb2305/timex.h
index 10e1bfe..e51a9d1 100644
--- a/include/asm-mn10300/unit-asb2305/timex.h
+++ b/include/asm-mn10300/unit-asb2305/timex.h
@@ -50,8 +50,7 @@ static inline void startup_jiffies_counter(void)
md = TM0MD_SRC_IOCLK_32;
rate = MN10300_JCCLK / 32 / HZ;
- if (rate > TMJCBR_MAX)
- BUG();
+ BUG_ON(rate > TMJCBR_MAX);
}
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/alpha/kernel/pci_iommu.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/arch/alpha/kernel/pci_iommu.c b/arch/alpha/kernel/pci_iommu.c
index b9094da..9ebaca2 100644
--- a/arch/alpha/kernel/pci_iommu.c
+++ b/arch/alpha/kernel/pci_iommu.c
@@ -310,8 +310,7 @@ pci_map_single(struct pci_dev *pdev, void *cpu_addr, size_t size, int dir)
{
int dac_allowed;
- if (dir == PCI_DMA_NONE)
- BUG();
+ BUG_ON(dir == PCI_DMA_NONE);
dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
return pci_map_single_1(pdev, cpu_addr, size, dac_allowed);
@@ -324,8 +323,7 @@ pci_map_page(struct pci_dev *pdev, struct page *page, unsigned long offset,
{
int dac_allowed;
- if (dir == PCI_DMA_NONE)
- BUG();
+ BUG_ON(dir == PCI_DMA_NONE);
dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
return pci_map_single_1(pdev, (char *)page_address(page) + offset,
@@ -348,8 +346,7 @@ pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr, size_t size,
struct pci_iommu_arena *arena;
long dma_ofs, npages;
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
if (dma_addr >= __direct_map_base
&& dma_addr < __direct_map_base + __direct_map_size) {
@@ -641,8 +638,7 @@ pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
int dac_allowed;
struct device *dev;
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
dac_allowed = pdev ? pci_dac_dma_supported(pdev, pdev->dma_mask) : 0;
@@ -723,8 +719,7 @@ pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg, int nents,
dma_addr_t max_dma;
dma_addr_t fbeg, fend;
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
if (! alpha_mv.mv_pci_tbi)
return;
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/frv/kernel/uaccess.c | 6 ++----
arch/frv/mb93090-mb00/pci-dma-nommu.c | 6 ++----
arch/frv/mb93090-mb00/pci-dma.c | 6 ++----
include/asm-frv/pci.h | 7 ++-----
4 files changed, 8 insertions(+), 17 deletions(-)
diff --git a/arch/frv/kernel/uaccess.c b/arch/frv/kernel/uaccess.c
index 9fb771a..374f88d 100644
--- a/arch/frv/kernel/uaccess.c
+++ b/arch/frv/kernel/uaccess.c
@@ -23,8 +23,7 @@ long strncpy_from_user(char *dst, const char __user *src, long count)
char *p, ch;
long err = -EFAULT;
- if (count < 0)
- BUG();
+ BUG_ON(count < 0);
p = dst;
@@ -76,8 +75,7 @@ long strnlen_user(const char __user *src, long count)
long err = 0;
char ch;
- if (count < 0)
- BUG();
+ BUG_ON(count < 0);
#ifndef CONFIG_MMU
if ((unsigned long) src < memory_start)
diff --git a/arch/frv/mb93090-mb00/pci-dma-nommu.c b/arch/frv/mb93090-mb00/pci-dma-nommu.c
index 52ff9ae..4e1ba0b 100644
--- a/arch/frv/mb93090-mb00/pci-dma-nommu.c
+++ b/arch/frv/mb93090-mb00/pci-dma-nommu.c
@@ -116,8 +116,7 @@ EXPORT_SYMBOL(dma_free_coherent);
dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
enum dma_data_direction direction)
{
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
frv_cache_wback_inv((unsigned long) ptr, (unsigned long) ptr + size);
@@ -151,8 +150,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
frv_cache_wback_inv(sg_dma_address(&sg[i]),
sg_dma_address(&sg[i]) + sg_dma_len(&sg[i]));
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
return nents;
}
diff --git a/arch/frv/mb93090-mb00/pci-dma.c b/arch/frv/mb93090-mb00/pci-dma.c
index 3ddedeb..45954f0 100644
--- a/arch/frv/mb93090-mb00/pci-dma.c
+++ b/arch/frv/mb93090-mb00/pci-dma.c
@@ -48,8 +48,7 @@ EXPORT_SYMBOL(dma_free_coherent);
dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
enum dma_data_direction direction)
{
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
frv_cache_wback_inv((unsigned long) ptr, (unsigned long) ptr + size);
@@ -81,8 +80,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
void *vaddr;
int i;
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
dampr2 = __get_DAMPR(2);
diff --git a/include/asm-frv/pci.h b/include/asm-frv/pci.h
index 585d9b4..cc685e6 100644
--- a/include/asm-frv/pci.h
+++ b/include/asm-frv/pci.h
@@ -87,8 +87,7 @@ static inline void pci_dma_sync_single(struct pci_dev *hwdev,
dma_addr_t dma_handle,
size_t size, int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
frv_cache_wback_inv((unsigned long)bus_to_virt(dma_handle),
(unsigned long)bus_to_virt(dma_handle) + size);
@@ -105,9 +104,7 @@ static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
int nelems, int direction)
{
int i;
-
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
for (i = 0; i < nelems; i++)
frv_cache_wback_inv(sg_dma_address(&sg[i]),
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/s390/kernel/debug.c | 3 +--
arch/s390/kernel/setup.c | 3 +--
drivers/s390/char/tape_3590.c | 3 +--
drivers/s390/char/tape_core.c | 6 ++----
drivers/s390/char/tape_std.c | 4 ++--
5 files changed, 7 insertions(+), 12 deletions(-)
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index ba03fc0..39137b9 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -698,8 +698,7 @@ debug_info_t *debug_register_mode(const char *name, int pages_per_area,
if ((uid != 0) || (gid != 0))
pr_warning("Root becomes the owner of all s390dbf files "
"in sysfs\n");
- if (!initialized)
- BUG();
+ BUG_ON(!initialized);
mutex_lock(&debug_mutex);
/* create new debug_info */
diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index c5cfb61..bfbbd19 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -125,8 +125,7 @@ void __cpuinit cpu_init(void)
atomic_inc(&init_mm.mm_count);
current->active_mm = &init_mm;
- if (current->mm)
- BUG();
+ BUG_ON(current->mm);
enter_lazy_tlb(&init_mm, current);
}
diff --git a/drivers/s390/char/tape_3590.c b/drivers/s390/char/tape_3590.c
index 71605a1..cdb5222 100644
--- a/drivers/s390/char/tape_3590.c
+++ b/drivers/s390/char/tape_3590.c
@@ -661,8 +661,7 @@ tape_3590_bread(struct tape_device *device, struct request *req)
ccw++;
dst += TAPEBLOCK_HSEC_SIZE;
}
- if (off > bv->bv_len)
- BUG();
+ BUG_ON(off > bv->bv_len);
}
ccw = tape_ccw_end(ccw, NOP, 0, NULL);
DBF_EVENT(6, "xBREDccwg\n");
diff --git a/drivers/s390/char/tape_core.c b/drivers/s390/char/tape_core.c
index f9bb51f..bb04f9a 100644
--- a/drivers/s390/char/tape_core.c
+++ b/drivers/s390/char/tape_core.c
@@ -639,8 +639,7 @@ tape_alloc_request(int cplength, int datasize)
{
struct tape_request *request;
- if (datasize > PAGE_SIZE || (cplength*sizeof(struct ccw1)) > PAGE_SIZE)
- BUG();
+ BUG_ON(datasize > PAGE_SIZE || (cplength*sizeof(struct ccw1)) > PAGE_SIZE);
DBF_LH(6, "tape_alloc_request(%d, %d)\n", cplength, datasize);
@@ -797,8 +796,7 @@ static void tape_long_busy_timeout(unsigned long data)
device = (struct tape_device *) data;
spin_lock_irq(get_ccwdev_lock(device->cdev));
request = list_entry(device->req_queue.next, struct tape_request, list);
- if (request->status != TAPE_REQUEST_LONG_BUSY)
- BUG();
+ BUG_ON(request->status != TAPE_REQUEST_LONG_BUSY);
DBF_LH(6, "%08x: Long busy timeout.\n", device->cdev_id);
__tape_start_next_request(device);
device->lb_timeout.data = (unsigned long) tape_put_device(device);
diff --git a/drivers/s390/char/tape_std.c b/drivers/s390/char/tape_std.c
index 5bd573d..37c4447 100644
--- a/drivers/s390/char/tape_std.c
+++ b/drivers/s390/char/tape_std.c
@@ -39,8 +39,8 @@ tape_std_assign_timeout(unsigned long data)
int rc;
request = (struct tape_request *) data;
- if ((device = request->device) == NULL)
- BUG();
+ device = request->device;
+ BUG_ON(device == NULL);
DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
device->cdev_id);
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/blackfin/include/asm/pci.h | 22 ++++++----------------
1 files changed, 6 insertions(+), 16 deletions(-)
diff --git a/arch/blackfin/include/asm/pci.h b/arch/blackfin/include/asm/pci.h
index 6127735..4934ba1 100644
--- a/arch/blackfin/include/asm/pci.h
+++ b/arch/blackfin/include/asm/pci.h
@@ -51,8 +51,7 @@ static inline void pcibios_penalize_isa_irq(int irq)
static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
size_t size, int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
/* return virt_to_bus(ptr); */
return (dma_addr_t) ptr;
@@ -68,9 +67,7 @@ static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr,
static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
size_t size, int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
-
+ BUG_ON(direction == PCI_DMA_NONE);
/* Nothing to do */
}
@@ -92,8 +89,7 @@ static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
int nents, int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
+ BUG_ON(direction == PCI_DMA_NONE);
return nents;
}
@@ -104,9 +100,7 @@ static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg,
static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
int nents, int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
-
+ BUG_ON(direction == PCI_DMA_NONE);
/* Nothing to do */
}
@@ -123,9 +117,7 @@ static inline void pci_dma_sync_single(struct pci_dev *hwdev,
dma_addr_t dma_handle, size_t size,
int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
-
+ BUG_ON(direction == PCI_DMA_NONE);
/* Nothing to do */
}
@@ -139,9 +131,7 @@ static inline void pci_dma_sync_sg(struct pci_dev *hwdev,
struct scatterlist *sg, int nelems,
int direction)
{
- if (direction == PCI_DMA_NONE)
- BUG();
-
+ BUG_ON(direction == PCI_DMA_NONE);
/* Nothing to do */
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/cris/mm/init.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
index 2fdd212..514f46a 100644
--- a/arch/cris/mm/init.c
+++ b/arch/cris/mm/init.c
@@ -25,8 +25,7 @@ mem_init(void)
int codesize, reservedpages, datasize, initsize;
unsigned long tmp;
- if(!mem_map)
- BUG();
+ BUG_ON(!mem_map);
/* max/min_low_pfn was set by setup.c
* now we just copy it to some other necessary places...
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
mm/nommu.c | 15 +++++----------
1 files changed, 5 insertions(+), 10 deletions(-)
diff --git a/mm/nommu.c b/mm/nommu.c
index 2fcf47d..22ddd6b 100644
--- a/mm/nommu.c
+++ b/mm/nommu.c
@@ -486,21 +486,16 @@ static noinline void validate_nommu_regions(void)
return;
last = rb_entry(lastp, struct vm_region, vm_rb);
- if (unlikely(last->vm_end <= last->vm_start))
- BUG();
- if (unlikely(last->vm_top < last->vm_end))
- BUG();
+ BUG_ON(last->vm_end <= last->vm_start);
+ BUG_ON(last->vm_top < last->vm_end);
while ((p = rb_next(lastp))) {
region = rb_entry(p, struct vm_region, vm_rb);
last = rb_entry(lastp, struct vm_region, vm_rb);
- if (unlikely(region->vm_end <= region->vm_start))
- BUG();
- if (unlikely(region->vm_top < region->vm_end))
- BUG();
- if (unlikely(region->vm_start < last->vm_top))
- BUG();
+ BUG_ON(region->vm_end <= region->vm_start);
+ BUG_ON(region->vm_top < region->vm_end);
+ BUG_ON(region->vm_start < last->vm_top);
lastp = p;
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/parisc/kernel/pci-dma.c | 12 ++++--------
1 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/parisc/kernel/pci-dma.c b/arch/parisc/kernel/pci-dma.c
index df47895..2587563 100644
--- a/arch/parisc/kernel/pci-dma.c
+++ b/arch/parisc/kernel/pci-dma.c
@@ -480,8 +480,7 @@ static int pa11_dma_map_sg(struct device *dev, struct scatterlist *sglist, int n
{
int i;
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
for (i = 0; i < nents; i++, sglist++ ) {
unsigned long vaddr = sg_virt_addr(sglist);
@@ -496,8 +495,7 @@ static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, in
{
int i;
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
if (direction == DMA_TO_DEVICE)
return;
@@ -511,16 +509,14 @@ static void pa11_dma_unmap_sg(struct device *dev, struct scatterlist *sglist, in
static void pa11_dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction)
{
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle) + offset, size);
}
static void pa11_dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, unsigned long offset, size_t size, enum dma_data_direction direction)
{
- if (direction == DMA_NONE)
- BUG();
+ BUG_ON(direction == DMA_NONE);
flush_kernel_dcache_range((unsigned long) phys_to_virt(dma_handle) + offset, size);
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
kernel/sysctl.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/kernel/sysctl.c b/kernel/sysctl.c
index c5ef44f..ae992c4 100644
--- a/kernel/sysctl.c
+++ b/kernel/sysctl.c
@@ -1513,8 +1513,7 @@ void sysctl_head_put(struct ctl_table_header *head)
struct ctl_table_header *sysctl_head_grab(struct ctl_table_header *head)
{
- if (!head)
- BUG();
+ BUG_ON(!head);
spin_lock(&sysctl_lock);
if (!use_table(head))
head = ERR_PTR(-ENOENT);
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/m32r/kernel/setup.c | 3 +--
arch/m32r/kernel/smp.c | 9 +++------
2 files changed, 4 insertions(+), 8 deletions(-)
diff --git a/arch/m32r/kernel/setup.c b/arch/m32r/kernel/setup.c
index 0392112..6e119ee 100644
--- a/arch/m32r/kernel/setup.c
+++ b/arch/m32r/kernel/setup.c
@@ -402,8 +402,7 @@ void __init cpu_init (void)
/* Set up and load the per-CPU TSS and LDT */
atomic_inc(&init_mm.mm_count);
current->active_mm = &init_mm;
- if (current->mm)
- BUG();
+ BUG_ON(current->mm);
/* Force FPU initialization */
current_thread_info()->status = 0;
diff --git a/arch/m32r/kernel/smp.c b/arch/m32r/kernel/smp.c
index 929e5c9..17c96bb 100644
--- a/arch/m32r/kernel/smp.c
+++ b/arch/m32r/kernel/smp.c
@@ -338,8 +338,7 @@ void smp_flush_tlb_page(struct vm_area_struct *vma, unsigned long va)
cpu_clear(cpu_id, cpu_mask);
#ifdef DEBUG_SMP
- if (!mm)
- BUG();
+ BUG_ON(!mm);
#endif
if (*mmc != NO_CONTEXT) {
@@ -385,8 +384,7 @@ static void flush_tlb_others(cpumask_t cpumask, struct mm_struct *mm,
#ifdef DEBUG_SMP
unsigned long flags;
__save_flags(flags);
- if (!(flags & 0x0040)) /* Interrupt Disable NONONO */
- BUG();
+ BUG_ON(!(flags & 0x0040)); /* Interrupt Disable NONONO */
#endif /* DEBUG_SMP */
/*
@@ -805,8 +803,7 @@ unsigned long send_IPI_mask_phys(cpumask_t physid_mask, int ipi_num,
if (mask & ~physids_coerce(phys_cpu_present_map))
BUG();
- if (ipi_num >= NR_IPIS)
- BUG();
+ BUG_ON(ipi_num >= NR_IPIS);
mask <<= IPI_SHIFT;
ipilock = &ipi_lock[ipi_num];
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
arch/xtensa/kernel/pci-dma.c | 9 +++------
1 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/xtensa/kernel/pci-dma.c b/arch/xtensa/kernel/pci-dma.c
index f5319d7..3677bd0 100644
--- a/arch/xtensa/kernel/pci-dma.c
+++ b/arch/xtensa/kernel/pci-dma.c
@@ -47,10 +47,8 @@ dma_alloc_coherent(struct device *dev,size_t size,dma_addr_t *handle,gfp_t flag)
/* We currently don't support coherent memory outside KSEG */
- if (ret < XCHAL_KSEG_CACHED_VADDR
- || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE)
- BUG();
-
+ BUG_ON(ret < XCHAL_KSEG_CACHED_VADDR
+ || ret >= XCHAL_KSEG_CACHED_VADDR + XCHAL_KSEG_SIZE);
if (ret != 0) {
memset((void*) ret, 0, size);
@@ -67,8 +65,7 @@ void dma_free_coherent(struct device *hwdev, size_t size,
{
long addr=(long)vaddr+XCHAL_KSEG_CACHED_VADDR-XCHAL_KSEG_BYPASS_VADDR;
- if (addr < 0 || addr >= XCHAL_KSEG_SIZE)
- BUG();
+ BUG_ON(addr < 0 || addr >= XCHAL_KSEG_SIZE);
free_pages(addr, get_order(size));
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
drivers/scsi/lpfc/lpfc_els.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/drivers/scsi/lpfc/lpfc_els.c b/drivers/scsi/lpfc/lpfc_els.c
index a730248..ccdc1eb 100644
--- a/drivers/scsi/lpfc/lpfc_els.c
+++ b/drivers/scsi/lpfc/lpfc_els.c
@@ -6343,8 +6343,7 @@ lpfc_cmpl_fabric_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
{
struct ls_rjt stat;
- if ((cmdiocb->iocb_flag & LPFC_IO_FABRIC) != LPFC_IO_FABRIC)
- BUG();
+ BUG_ON((cmdiocb->iocb_flag & LPFC_IO_FABRIC) != LPFC_IO_FABRIC);
switch (rspiocb->iocb.ulpStatus) {
case IOSTAT_NPORT_RJT:
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
include/linux/reiserfs_fs.h | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h
index bc5114d..67a38f5 100644
--- a/include/linux/reiserfs_fs.h
+++ b/include/linux/reiserfs_fs.h
@@ -1707,8 +1707,7 @@ static inline int reiserfs_transaction_running(struct super_block *s)
struct reiserfs_transaction_handle *th = current->journal_info;
if (th && th->t_super == s)
return 1;
- if (th && th->t_super == NULL)
- BUG();
+ BUG_ON(th && th->t_super == NULL);
return 0;
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
fs/afs/netdevices.c | 3 +--
1 files changed, 1 insertions(+), 2 deletions(-)
diff --git a/fs/afs/netdevices.c b/fs/afs/netdevices.c
index 49f1894..7ad3650 100644
--- a/fs/afs/netdevices.c
+++ b/fs/afs/netdevices.c
@@ -20,8 +20,7 @@ int afs_get_MAC_address(u8 *mac, size_t maclen)
struct net_device *dev;
int ret = -ENODEV;
- if (maclen != ETH_ALEN)
- BUG();
+ BUG_ON(maclen != ETH_ALEN);
rtnl_lock();
dev = __dev_getfirstbyhwtype(&init_net, ARPHRD_ETHER);
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
drivers/misc/sgi-gru/grukservices.c | 3 +--
drivers/misc/sgi-gru/grumain.c | 3 +--
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/misc/sgi-gru/grukservices.c b/drivers/misc/sgi-gru/grukservices.c
index 880c55d..a942b33 100644
--- a/drivers/misc/sgi-gru/grukservices.c
+++ b/drivers/misc/sgi-gru/grukservices.c
@@ -603,8 +603,7 @@ static int quicktest(struct gru_state *gru)
if (gru_wait(cb) != CBS_IDLE)
BUG();
- if (*(unsigned long *)ds != MAGIC)
- BUG();
+ BUG_ON(*(unsigned long *)ds != MAGIC);
gru_vstore(cb, uv_gpa(&word1), 0, XTYPE_DW, 1, 1, IMA);
if (gru_wait(cb) != CBS_IDLE)
BUG();
diff --git a/drivers/misc/sgi-gru/grumain.c b/drivers/misc/sgi-gru/grumain.c
index 3d2fc21..65df0f6 100644
--- a/drivers/misc/sgi-gru/grumain.c
+++ b/drivers/misc/sgi-gru/grumain.c
@@ -153,8 +153,7 @@ static unsigned long reserve_resources(unsigned long *p, int n, int mmax,
do {
i = find_first_bit(p, mmax);
- if (i == mmax)
- BUG();
+ BUG_ON(i == mmax);
__clear_bit(i, p);
__set_bit(i, &bits);
if (idx)
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
drivers/ata/pata_hpt366.c | 3 +--
drivers/base/iommu.c | 4 +---
drivers/gpu/drm/i915/intel_fb.c | 6 ++----
drivers/mtd/ssfdc.c | 3 +--
drivers/sh/intc.c | 3 +--
5 files changed, 6 insertions(+), 13 deletions(-)
diff --git a/drivers/ata/pata_hpt366.c b/drivers/ata/pata_hpt366.c
index 65c28e5..8e0c9f6 100644
--- a/drivers/ata/pata_hpt366.c
+++ b/drivers/ata/pata_hpt366.c
@@ -234,8 +234,7 @@ static void hpt366_set_mode(struct ata_port *ap, struct ata_device *adev,
break;
clocks++;
}
- if (!clocks->xfer_mode)
- BUG();
+ BUG_ON(!clocks->xfer_mode);
/*
* Combine new mode bits with old config bits and disable
diff --git a/drivers/base/iommu.c b/drivers/base/iommu.c
index 5e039d4..e564416 100644
--- a/drivers/base/iommu.c
+++ b/drivers/base/iommu.c
@@ -25,9 +25,7 @@ static struct iommu_ops *iommu_ops;
void register_iommu(struct iommu_ops *ops)
{
- if (iommu_ops)
- BUG();
-
+ BUG_ON(iommu_ops);
iommu_ops = ops;
}
diff --git a/drivers/gpu/drm/i915/intel_fb.c b/drivers/gpu/drm/i915/intel_fb.c
index b7f0ebe..201b65c 100644
--- a/drivers/gpu/drm/i915/intel_fb.c
+++ b/drivers/gpu/drm/i915/intel_fb.c
@@ -663,8 +663,7 @@ static int intelfb_multi_fb_probe_crtc(struct drm_device *dev, struct drm_crtc *
if (connector->encoder->crtc == modeset->crtc) {
modeset->connectors[conn_count] = connector;
conn_count++;
- if (conn_count > INTELFB_CONN_LIMIT)
- BUG();
+ BUG_ON(conn_count > INTELFB_CONN_LIMIT);
}
}
@@ -812,8 +811,7 @@ static int intelfb_single_fb_probe(struct drm_device *dev)
if(connector->encoder->crtc == modeset->crtc) {
modeset->connectors[conn_count++] = connector;
- if (conn_count > INTELFB_CONN_LIMIT)
- BUG();
+ BUG_ON(conn_count > INTELFB_CONN_LIMIT);
}
}
diff --git a/drivers/mtd/ssfdc.c b/drivers/mtd/ssfdc.c
index 3f67e00..5a1d8e2 100644
--- a/drivers/mtd/ssfdc.c
+++ b/drivers/mtd/ssfdc.c
@@ -393,8 +393,7 @@ static int ssfdcr_readsect(struct mtd_blktrans_dev *dev,
" block_addr=%d\n", logic_sect_no, sectors_per_block, offset,
block_address);
- if (block_address >= ssfdc->map_len)
- BUG();
+ BUG_ON(block_address >= ssfdc->map_len);
block_address = ssfdc->logic_block_map[block_address];
diff --git a/drivers/sh/intc.c b/drivers/sh/intc.c
index 58d24c5..a031989 100644
--- a/drivers/sh/intc.c
+++ b/drivers/sh/intc.c
@@ -458,8 +458,7 @@ static unsigned int __init intc_prio_data(struct intc_desc *desc,
} else {
fn = REG_FN_MODIFY_BASE;
mode = MODE_PRIO_REG;
- if (!pr->set_reg)
- BUG();
+ BUG_ON(!pr->set_reg);
reg_e = pr->set_reg;
reg_d = pr->set_reg;
}
--
1.6.1.3
Signed-off-by: Stoyan Gaydarov <[email protected]>
---
drivers/crypto/ixp4xx_crypto.c | 4 +---
1 files changed, 1 insertions(+), 3 deletions(-)
diff --git a/drivers/crypto/ixp4xx_crypto.c b/drivers/crypto/ixp4xx_crypto.c
index d9e751b..12b09cf 100644
--- a/drivers/crypto/ixp4xx_crypto.c
+++ b/drivers/crypto/ixp4xx_crypto.c
@@ -1037,9 +1037,7 @@ static int aead_perform(struct aead_request *req, int encrypt,
BUG_ON(ivsize && !req->iv);
memcpy(crypt->iv, req->iv, ivsize);
- if (req->src != req->dst) {
- BUG(); /* -ENOTSUP because of my lazyness */
- }
+ BUG_ON(req->src != req->dst); /* -ENOTSUP because of my lazyness */
req_ctx->buffer = dma_pool_alloc(buffer_pool, flags, &crypt->src_buf);
if (!req_ctx->buffer)
--
1.6.1.3
From: Stoyan Gaydarov <[email protected]>
Date: Tue, 10 Mar 2009 00:10:33 -0500
> Signed-off-by: Stoyan Gaydarov <[email protected]>
Acked-by: David S. Miller <[email protected]>
From: Stoyan Gaydarov <[email protected]>
Date: Tue, 10 Mar 2009 00:10:28 -0500
> Signed-off-by: Stoyan Gaydarov <[email protected]>
Acked-by: David S. Miller <[email protected]>
From: Stoyan Gaydarov <[email protected]>
Date: Tue, 10 Mar 2009 00:10:41 -0500
> Signed-off-by: Stoyan Gaydarov <[email protected]>
Acked-by: Hirokazu Takata <[email protected]>
* Stoyan Gaydarov <[email protected]> wrote:
> Signed-off-by: Stoyan Gaydarov <[email protected]>
> ---
> arch/x86/kernel/cpu/common.c | 6 ++----
> arch/x86/kernel/quirks.c | 3 +--
> arch/x86/mach-voyager/voyager_smp.c | 6 ++----
> 3 files changed, 5 insertions(+), 10 deletions(-)
applied, thanks.
To find candidates i suspect you used something like this:
grep -r -B 1 'BUG()' arch/x86/ | grep -E '\<if\>[^(]*\([^{(]*$' -A 1
right? It gives the output below - exactly the sites you
touched.
Ingo
arch/x86/kernel/cpu/common.c- if (me->mm)
arch/x86/kernel/cpu/common.c: BUG();
--
arch/x86/kernel/cpu/common.c- if (curr->mm)
arch/x86/kernel/cpu/common.c: BUG();
--
arch/x86/kernel/quirks.c- if (rcba_base == NULL)
arch/x86/kernel/quirks.c: BUG();
Commit-ID: 8c5dfd25519bf302ba43daa59976c4d675a594a7
Gitweb: http://git.kernel.org/tip/8c5dfd25519bf302ba43daa59976c4d675a594a7
Author: "Stoyan Gaydarov" <[email protected]>
AuthorDate: Tue, 10 Mar 2009 00:10:32 -0500
Commit: Ingo Molnar <[email protected]>
CommitDate: Tue, 10 Mar 2009 09:55:18 +0100
x86: BUG to BUG_ON changes
Impact: cleanup
Signed-off-by: Stoyan Gaydarov <[email protected]>
LKML-Reference: <[email protected]>
Signed-off-by: Ingo Molnar <[email protected]>
---
arch/x86/kernel/cpu/common.c | 6 ++----
arch/x86/kernel/quirks.c | 3 +--
2 files changed, 3 insertions(+), 6 deletions(-)
diff --git a/arch/x86/kernel/cpu/common.c b/arch/x86/kernel/cpu/common.c
index 826d5c8..f886997 100644
--- a/arch/x86/kernel/cpu/common.c
+++ b/arch/x86/kernel/cpu/common.c
@@ -1078,8 +1078,7 @@ void __cpuinit cpu_init(void)
atomic_inc(&init_mm.mm_count);
me->active_mm = &init_mm;
- if (me->mm)
- BUG();
+ BUG_ON(me->mm);
enter_lazy_tlb(&init_mm, me);
load_sp0(t, ¤t->thread);
@@ -1145,8 +1144,7 @@ void __cpuinit cpu_init(void)
*/
atomic_inc(&init_mm.mm_count);
curr->active_mm = &init_mm;
- if (curr->mm)
- BUG();
+ BUG_ON(curr->mm);
enter_lazy_tlb(&init_mm, curr);
load_sp0(t, thread);
diff --git a/arch/x86/kernel/quirks.c b/arch/x86/kernel/quirks.c
index 309949e..6a5a297 100644
--- a/arch/x86/kernel/quirks.c
+++ b/arch/x86/kernel/quirks.c
@@ -74,8 +74,7 @@ static void ich_force_hpet_resume(void)
if (!force_hpet_address)
return;
- if (rcba_base == NULL)
- BUG();
+ BUG_ON(rcba_base == NULL);
/* read the Function Disable register, dword mode only */
val = readl(rcba_base + 0x3404);
Stoyan Gaydarov wrote:
> Signed-off-by: Stoyan Gaydarov <[email protected]>
> ---
> fs/btrfs/ctree.c | 3 +--
> fs/btrfs/extent-tree.c | 3 +--
> fs/btrfs/free-space-cache.c | 3 +--
> fs/btrfs/tree-log.c | 3 +--
> 4 files changed, 4 insertions(+), 8 deletions(-)
>
> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
> index 37f31b5..2c590b0 100644
> --- a/fs/btrfs/ctree.c
> +++ b/fs/btrfs/ctree.c
> @@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_root
> BUG_ON(!path->nodes[level]);
> lower = path->nodes[level];
> nritems = btrfs_header_nritems(lower);
> - if (slot > nritems)
> - BUG();
> + BUG_ON(slot > nritems);
> if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root))
> BUG();
^ You seem to have missed one.
> if (slot != nritems) {
> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
> index 9abf81f..0314ab6 100644
> --- a/fs/btrfs/extent-tree.c
> +++ b/fs/btrfs/extent-tree.c
> @@ -672,8 +672,7 @@ static noinline int insert_extents(struct btrfs_trans_handle *trans,
> keys+i, data_size+i, total-i);
> BUG_ON(ret < 0);
>
> - if (last && ret > 1)
> - BUG();
> + BUG_ON(last && ret > 1);
>
> leaf = path->nodes[0];
> for (c = 0; c < ret; c++) {
> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
> index d1e5f0e..b0c7661 100644
> --- a/fs/btrfs/free-space-cache.c
> +++ b/fs/btrfs/free-space-cache.c
> @@ -267,8 +267,7 @@ static int __btrfs_add_free_space(struct btrfs_block_group_cache *block_group,
> out:
> if (ret) {
> printk(KERN_ERR "btrfs: unable to add free space :%d\n", ret);
> - if (ret == -EEXIST)
> - BUG();
> + BUG_ON(ret == -EEXIST);
> }
>
> kfree(alloc_info);
> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
> index 9c462fb..2c892f6 100644
> --- a/fs/btrfs/tree-log.c
> +++ b/fs/btrfs/tree-log.c
> @@ -1150,8 +1150,7 @@ insert:
> ret = insert_one_name(trans, root, path, key->objectid, key->offset,
> name, name_len, log_type, &log_key);
>
> - if (ret && ret != -ENOENT)
> - BUG();
> + BUG_ON(ret && ret != -ENOENT);
> goto out;
> }
>
On Tue, Mar 10, 2009 at 12:10:27AM -0500, Stoyan Gaydarov wrote:
> --- a/drivers/staging/usbip/vhci_sysfs.c
> +++ b/drivers/staging/usbip/vhci_sysfs.c
> @@ -31,8 +31,7 @@ static ssize_t show_status(struct device *dev, struct device_attribute *attr,
> char *s = out;
> int i = 0;
>
> - if (!the_controller || !out)
> - BUG();
> + BUG_ON(!the_controller || !out);
Should be deleted partially.
> spin_lock(&the_controller->lock);
On Tue, Mar 10, 2009 at 12:10:28AM -0500, Stoyan Gaydarov wrote:
> --- a/drivers/net/pppol2tp.c
> +++ b/drivers/net/pppol2tp.c
> @@ -1222,8 +1222,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)
> struct pppol2tp_session *session;
> struct sock *sk;
>
> - if (tunnel == NULL)
> - BUG();
> + BUG_ON(tunnel == NULL);
NAK, should be deleted, and kernel will oops anyway.
> PRINTK(tunnel->debug, PPPOL2TP_MSG_CONTROL, KERN_INFO,
> "%s: closing all sessions...\n", tunnel->name);
Am Tuesday 10 March 2009 06:10:34 schrieb Stoyan Gaydarov:
> +++ b/drivers/s390/char/tape_std.c
> @@ -39,8 +39,8 @@ tape_std_assign_timeout(unsigned long data)
> int rc;
>
> request = (struct tape_request *) data;
> - if ((device = request->device) == NULL)
> - BUG();
> + device = request->device;
> + BUG_ON(device == NULL);
>
> DBF_EVENT(3, "%08x: Assignment timeout. Device busy.\n",
> device->cdev_id);
Most of the patch look good. Since !pointer seems to be preferred over
pointer == NULL, this hunk can be changed to
BUG_ON(!device);
Christian
From: Alexey Dobriyan <[email protected]>
Date: Tue, 10 Mar 2009 13:23:55 +0300
> On Tue, Mar 10, 2009 at 12:10:28AM -0500, Stoyan Gaydarov wrote:
> > --- a/drivers/net/pppol2tp.c
> > +++ b/drivers/net/pppol2tp.c
> > @@ -1222,8 +1222,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)
> > struct pppol2tp_session *session;
> > struct sock *sk;
> >
> > - if (tunnel == NULL)
> > - BUG();
> > + BUG_ON(tunnel == NULL);
>
> NAK, should be deleted, and kernel will oops anyway.
I think in situations such as this, where someone is trying to rid the
tree of an interface (where an exactly equivalent alternative
expression exists) so it can be deleted, it is absolutely unreasonable
to ask them to make non-trivial transformations like you are
requesting on top of what can already be a quite daunting task.
Please rescind your NACK, thanks.
This is the kind of NACK which makes me absolutely furious when I try
to contribute to projects other than the kernel. So please don't make
the kernel suck as much as those projects do. It's a deterrant to
contributors.
On Tue, 2009-03-10 at 00:10 -0500, Stoyan Gaydarov wrote:
> Signed-off-by: Stoyan Gaydarov <[email protected]>
> ---
> fs/btrfs/ctree.c | 3 +--
> fs/btrfs/extent-tree.c | 3 +--
> fs/btrfs/free-space-cache.c | 3 +--
> fs/btrfs/tree-log.c | 3 +--
> 4 files changed, 4 insertions(+), 8 deletions(-)
>
Thanks, I've queued this one up.
-chris
On Tue, Mar 10, 2009 at 4:16 AM, David John <[email protected]> wrote:
> Stoyan Gaydarov wrote:
>> Signed-off-by: Stoyan Gaydarov <[email protected]>
>> ---
>> fs/btrfs/ctree.c | 3 +--
>> fs/btrfs/extent-tree.c | 3 +--
>> fs/btrfs/free-space-cache.c | 3 +--
>> fs/btrfs/tree-log.c | 3 +--
>> 4 files changed, 4 insertions(+), 8 deletions(-)
>>
>> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
>> index 37f31b5..2c590b0 100644
>> --- a/fs/btrfs/ctree.c
>> +++ b/fs/btrfs/ctree.c
>> @@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_root
>> BUG_ON(!path->nodes[level]);
>> lower = path->nodes[level];
>> nritems = btrfs_header_nritems(lower);
>> - if (slot > nritems)
>> - BUG();
>> + BUG_ON(slot > nritems);
>> if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root))
>> BUG();
>
> ^ You seem to have missed one.
Actually that one was left on purpose because BUG_ON calls are not to
have any side effects and I do not know enough about btrfs to know
what BTRFS_NODEPTRS_PER_BLOCK does so it was left as is.
>
>> if (slot != nritems) {
>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>> index 9abf81f..0314ab6 100644
>> --- a/fs/btrfs/extent-tree.c
>> +++ b/fs/btrfs/extent-tree.c
>> @@ -672,8 +672,7 @@ static noinline int insert_extents(struct btrfs_trans_handle *trans,
>> keys+i, data_size+i, total-i);
>> BUG_ON(ret < 0);
>>
>> - if (last && ret > 1)
>> - BUG();
>> + BUG_ON(last && ret > 1);
>>
>> leaf = path->nodes[0];
>> for (c = 0; c < ret; c++) {
>> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
>> index d1e5f0e..b0c7661 100644
>> --- a/fs/btrfs/free-space-cache.c
>> +++ b/fs/btrfs/free-space-cache.c
>> @@ -267,8 +267,7 @@ static int __btrfs_add_free_space(struct btrfs_block_group_cache *block_group,
>> out:
>> if (ret) {
>> printk(KERN_ERR "btrfs: unable to add free space :%d\n", ret);
>> - if (ret == -EEXIST)
>> - BUG();
>> + BUG_ON(ret == -EEXIST);
>> }
>>
>> kfree(alloc_info);
>> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
>> index 9c462fb..2c892f6 100644
>> --- a/fs/btrfs/tree-log.c
>> +++ b/fs/btrfs/tree-log.c
>> @@ -1150,8 +1150,7 @@ insert:
>> ret = insert_one_name(trans, root, path, key->objectid, key->offset,
>> name, name_len, log_type, &log_key);
>>
>> - if (ret && ret != -ENOENT)
>> - BUG();
>> + BUG_ON(ret && ret != -ENOENT);
>> goto out;
>> }
>>
>
>
--
-Stoyan
>>> if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root))
>>> BUG();
>>
>> ^ You seem to have missed one.
>
> Actually that one was left on purpose because BUG_ON calls are not to
> have any side effects and I do not know enough about btrfs to know
> what BTRFS_NODEPTRS_PER_BLOCK does so it was left as is.
>
BTRFS_NODEPTRS_PER_BLOCK has no side effects - it's defined as:
00284 #define BTRFS_NODEPTRS_PER_BLOCK(r) (((r)->nodesize - \
00285 sizeof(struct btrfs_header)) / \
00286 sizeof(struct btrfs_key_ptr))
so it should be fine to put it in the BUG_ON.
----- Original Message -----
From: "Stoyan Gaydarov" <[email protected]>
To: <[email protected]>
Cc: <[email protected]>; <[email protected]>;
<[email protected]>
Sent: Tuesday, March 10, 2009 6:16 PM
Subject: Re: [PATCH 01/25] [btrfs] BUG to BUG_ON changes
> On Tue, Mar 10, 2009 at 4:16 AM, David John <[email protected]> wrote:
>> Stoyan Gaydarov wrote:
>>> Signed-off-by: Stoyan Gaydarov <[email protected]>
>>> ---
>>> fs/btrfs/ctree.c | 3 +--
>>> fs/btrfs/extent-tree.c | 3 +--
>>> fs/btrfs/free-space-cache.c | 3 +--
>>> fs/btrfs/tree-log.c | 3 +--
>>> 4 files changed, 4 insertions(+), 8 deletions(-)
>>>
>>> diff --git a/fs/btrfs/ctree.c b/fs/btrfs/ctree.c
>>> index 37f31b5..2c590b0 100644
>>> --- a/fs/btrfs/ctree.c
>>> +++ b/fs/btrfs/ctree.c
>>> @@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle
>>> *trans, struct btrfs_root
>>> BUG_ON(!path->nodes[level]);
>>> lower = path->nodes[level];
>>> nritems = btrfs_header_nritems(lower);
>>> - if (slot > nritems)
>>> - BUG();
>>> + BUG_ON(slot > nritems);
>>> if (nritems == BTRFS_NODEPTRS_PER_BLOCK(root))
>>> BUG();
>>
>> ^ You seem to have missed one.
>
> Actually that one was left on purpose because BUG_ON calls are not to
> have any side effects and I do not know enough about btrfs to know
> what BTRFS_NODEPTRS_PER_BLOCK does so it was left as is.
>
>>
>>> if (slot != nritems) {
>>> diff --git a/fs/btrfs/extent-tree.c b/fs/btrfs/extent-tree.c
>>> index 9abf81f..0314ab6 100644
>>> --- a/fs/btrfs/extent-tree.c
>>> +++ b/fs/btrfs/extent-tree.c
>>> @@ -672,8 +672,7 @@ static noinline int insert_extents(struct
>>> btrfs_trans_handle *trans,
>>> keys+i, data_size+i, total-i);
>>> BUG_ON(ret < 0);
>>>
>>> - if (last && ret > 1)
>>> - BUG();
>>> + BUG_ON(last && ret > 1);
>>>
>>> leaf = path->nodes[0];
>>> for (c = 0; c < ret; c++) {
>>> diff --git a/fs/btrfs/free-space-cache.c b/fs/btrfs/free-space-cache.c
>>> index d1e5f0e..b0c7661 100644
>>> --- a/fs/btrfs/free-space-cache.c
>>> +++ b/fs/btrfs/free-space-cache.c
>>> @@ -267,8 +267,7 @@ static int __btrfs_add_free_space(struct
>>> btrfs_block_group_cache *block_group,
>>> out:
>>> if (ret) {
>>> printk(KERN_ERR "btrfs: unable to add free space :%d\n", ret);
>>> - if (ret == -EEXIST)
>>> - BUG();
>>> + BUG_ON(ret == -EEXIST);
>>> }
>>>
>>> kfree(alloc_info);
>>> diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
>>> index 9c462fb..2c892f6 100644
>>> --- a/fs/btrfs/tree-log.c
>>> +++ b/fs/btrfs/tree-log.c
>>> @@ -1150,8 +1150,7 @@ insert:
>>> ret = insert_one_name(trans, root, path, key->objectid, key->offset,
>>> name, name_len, log_type, &log_key);
>>>
>>> - if (ret && ret != -ENOENT)
>>> - BUG();
>>> + BUG_ON(ret && ret != -ENOENT);
>>> goto out;
>>> }
>>>
>>
>>
>
> --
>
> -Stoyan
> --
> To unsubscribe from this list: send the line "unsubscribe linux-btrfs" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
Stoyan Gaydarov wrote:
> Signed-off-by: Stoyan Gaydarov <[email protected]>
> ---
> drivers/net/atl1e/atl1e_main.c | 3 +--
> drivers/net/chelsio/sge.c | 3 +--
> drivers/net/ixgb/ixgb_osdep.h | 2 +-
> drivers/net/pppol2tp.c | 3 +--
> drivers/net/wireless/ath9k/core.h | 6 +-----
> 5 files changed, 5 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/net/ixgb/ixgb_osdep.h
> b/drivers/net/ixgb/ixgb_osdep.h
> index d92e72b..371a6be 100644
> --- a/drivers/net/ixgb/ixgb_osdep.h
> +++ b/drivers/net/ixgb/ixgb_osdep.h
> @@ -40,7 +40,7 @@
> #include <linux/sched.h>
>
> #undef ASSERT
> -#define ASSERT(x) if (!(x)) BUG()
> +#define ASSERT(x) BUG_ON(!(x))
> #define MSGOUT(S, A, B) printk(KERN_DEBUG S "\n", A, B)
>
> #ifdef DBG
ack the ixgb portion
Acked-by: Jesse Brandeburg <[email protected]>
Stoyan Gaydarov <[email protected]> wrote:
> Subject: [PATCH 10/25] [mn10300] BUG to BUG_ON changes
> Date: Tue, 10 Mar 2009 00:10:35 -0500
> X-RedHat-Spam-Score: 0
>
> Signed-off-by: Stoyan Gaydarov <[email protected]>
Acked-by: David Howells <[email protected]>
Stoyan Gaydarov <[email protected]> wrote:
> Subject: [PATCH 12/25] [frv] BUG to BUG_ON changes
> Date: Tue, 10 Mar 2009 00:10:37 -0500
> X-RedHat-Spam-Score: -1.333
>
> Signed-off-by: Stoyan Gaydarov <[email protected]>
Acked-by: David Howells <[email protected]>
Stoyan Gaydarov <[email protected]> wrote:
> Subject: [PATCH 21/25] [afs] BUG to BUG_ON changes
> Date: Tue, 10 Mar 2009 00:10:46 -0500
> X-RedHat-Spam-Score: -1.333
>
> Signed-off-by: Stoyan Gaydarov <[email protected]>
Acked-by: David Howells <[email protected]>
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 <[email protected]>
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 = (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 = (VDMA_PGTBL_ENTRY *)KSEG1ADDR(pgtbl);
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 addr, int srs)
u32 *w;
unsigned char *b;
- if (!cpu_has_veic && !cpu_has_vint)
- BUG();
+ BUG_ON(!cpu_has_veic && !cpu_has_vint);
if (addr == NULL) {
handler = (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)
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 = type + KM_TYPE_NR*smp_processor_id();
vaddr = __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;
}
- if (vaddr != __fix_to_virt(FIX_KMAP_BEGIN+idx))
- BUG();
+ BUG_ON(vaddr != __fix_to_virt(FIX_KMAP_BEGIN + idx));
/*
* 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 = (pte_t *) alloc_bootmem_low_pages(PAGE_SIZE);
set_pmd(pmd, __pmd((unsigned long)pte));
- if (pte != pte_offset_kernel(pmd, 0))
- BUG();
+ BUG_ON(pte != pte_offset_kernel(pmd, 0));
}
vaddr += 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 long address,
end = address + size;
if (end > PMD_SIZE)
end = PMD_SIZE;
- if (address >= end)
- BUG();
+ BUG_ON(address >= end);
pfn = phys_addr >> PAGE_SHIFT;
do {
if (!pte_none(*pte)) {
@@ -52,8 +51,7 @@ static inline int remap_area_pmd(pmd_t * pmd, unsigned long address,
if (end > PGDIR_SIZE)
end = PGDIR_SIZE;
phys_addr -= address;
- if (address >= end)
- BUG();
+ BUG_ON(address >= end);
do {
pte_t * pte = 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 -= address;
dir = pgd_offset(&init_mm, address);
flush_cache_all();
- if (address >= end)
- BUG();
+ BUG_ON(address >= end);
do {
pud_t *pud;
pmd_t *pmd;
On Tue, Mar 10, 2009 at 12:10:42AM -0500, Stoyan Gaydarov wrote:
> Signed-off-by: Stoyan Gaydarov <[email protected]>
>
Hi Stoyan,
Thanks for sending this, but Helge Deller has already submitted
a similar patch queued for 2.6.30.
Thanks,
Kyle
On Tue, Mar 10, 2009 at 06:10:40AM +0100, Stoyan Gaydarov wrote:
> Signed-off-by: Stoyan Gaydarov <[email protected]>
> ---
> arch/cris/mm/init.c | 3 +--
> 1 files changed, 1 insertions(+), 2 deletions(-)
>
> diff --git a/arch/cris/mm/init.c b/arch/cris/mm/init.c
> index 2fdd212..514f46a 100644
> --- a/arch/cris/mm/init.c
> +++ b/arch/cris/mm/init.c
> @@ -25,8 +25,7 @@ mem_init(void)
> int codesize, reservedpages, datasize, initsize;
> unsigned long tmp;
>
> - if(!mem_map)
> - BUG();
> + BUG_ON(!mem_map);
>
> /* max/min_low_pfn was set by setup.c
> * now we just copy it to some other necessary places...
> --
> 1.6.1.3
Thanks, adding it to the CRIS tree.
/^JN - Jesper Nilsson
--
Jesper Nilsson -- [email protected]