BUG to BUG_ON changes
Subsystems (32)
cover BUG to BUG_ON changes
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(-)
PATCH 1/25 BUG to BUG_ON changes
--- 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(-)
fs/btrfs/ctree.c +1 -2
@@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_rootBUG_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) {
fs/btrfs/extent-tree.c +1 -2
@@ -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++) {
fs/btrfs/free-space-cache.c +1 -2
@@ -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);
fs/btrfs/tree-log.c +1 -2
@@ -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; }
Signature · 1 line
1.6.1.3
PATCH 2/25 BUG to BUG_ON changes
--- 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(-)
drivers/staging/comedi/drivers.c +2 -4
@@ -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; }
drivers/staging/otus/wwrap.c +1 -2
@@ -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);
drivers/staging/usbip/vhci_sysfs.c +1 -2
@@ -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);
drivers/staging/wlan-ng/hfa384x_usb.c +1 -3
@@ -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 */
Signature · 1 line
1.6.1.3
PATCH 3/25 BUG to BUG_ON changes
--- 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(-)
drivers/net/atl1e/atl1e_main.c +1 -2
@@ -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 =
drivers/net/chelsio/sge.c +1 -2
@@ -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);
drivers/net/ixgb/ixgb_osdep.h +1 -1
@@ -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
drivers/net/pppol2tp.c +1 -2
@@ -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);
drivers/net/wireless/ath9k/core.h +1 -5
@@ -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))
Signature · 1 line
1.6.1.3
PATCH 4/25 BUG to BUG_ON changes
--- 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(-)
arch/arm/common/gic.c +3 -6
@@ -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;
arch/arm/mach-ebsa110/io.c +8 -16
@@ -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);
arch/arm/mach-integrator/pci_v3.c +3 -6
@@ -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);
arch/arm/mach-rpc/dma.c +1 -2
@@ -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;
arch/arm/mach-versatile/pci.c +3 -6
@@ -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);
arch/arm/mm/init.c +1 -2
@@ -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; }
Signature · 1 line
1.6.1.3
PATCH 5/25 BUG to BUG_ON changes
--- 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(-)
arch/ia64/kernel/module.c +1 -2
@@ -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;
arch/ia64/kernel/setup.c +1 -2
@@ -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));
arch/ia64/mm/init.c +1 -2
@@ -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
arch/ia64/sn/kernel/io_common.c +5 -10
@@ -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;
arch/ia64/sn/kernel/io_init.c +4 -8
@@ -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;/*
arch/ia64/sn/kernel/setup.c +1 -2
@@ -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 ) {
arch/ia64/sn/kernel/sn2/sn_hwperf.c +2 -4
@@ -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 *objbif (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 );
arch/ia64/sn/pci/pcibr/pcibr_dma.c +1 -3
@@ -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 )
Signature · 1 line
1.6.1.3
PATCH 6/25 BUG to BUG_ON changes
--- 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(-)
arch/mips/jazz/jazzdma.c +1 -2
@@ -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);
arch/mips/kernel/traps.c +1 -2
@@ -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;
arch/mips/mm/ioremap.c +3 -6
@@ -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;
Signature · 1 line
1.6.1.3
PATCH 7/25 BUG to BUG_ON changes
--- 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(-)
arch/x86/kernel/cpu/common.c +2 -4
@@ -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);
arch/x86/kernel/quirks.c +1 -2
@@ -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 );
arch/x86/mach-voyager/voyager_smp.c +2 -4
@@ -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);
Signature · 1 line
1.6.1.3
PATCH 8/25 BUG to BUG_ON changes
--- 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(-)
arch/sparc/kernel/traps_64.c +1 -2
@@ -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 ) {
arch/sparc/lib/bitext.c +7 -10
@@ -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);
arch/sparc/mm/srmmu.c +1 -2
@@ -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 );
Signature · 1 line
1.6.1.3
PATCH 9/25 BUG to BUG_ON changes
--- 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(-)
arch/s390/kernel/debug.c +1 -2
@@ -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 */
arch/s390/kernel/setup.c +1 -2
@@ -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); }
drivers/s390/char/tape_3590.c +1 -2
@@ -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" );
drivers/s390/char/tape_core.c +2 -4
@@ -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);
drivers/s390/char/tape_std.c +2 -2
@@ -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);
Signature · 1 line
1.6.1.3
PATCH 10/25 BUG to BUG_ON changes
--- 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(-)
arch/mn10300/kernel/irq.c +1 -2
@@ -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 */
arch/mn10300/mm/init.c +1 -2
@@ -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)
arch/mn10300/mm/misalignment.c +1 -2
@@ -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;
include/asm-mn10300/unit-asb2303/timex.h +1 -2
@@ -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 ); } }
include/asm-mn10300/unit-asb2305/timex.h +1 -2
@@ -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 ); } }
Signature · 1 line
1.6.1.3
PATCH 11/25 BUG to BUG_ON changes
--- arch/alpha/kernel/pci_iommu.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-)
arch/alpha/kernel/pci_iommu.c +5 -10
@@ -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 ;
Signature · 1 line
1.6.1.3
PATCH 12/25 BUG to BUG_ON changes
--- 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(-)
arch/frv/kernel/uaccess.c +2 -4
@@ -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)
arch/frv/mb93090-mb00/pci-dma-nommu.c +2 -4
@@ -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; }
arch/frv/mb93090-mb00/pci-dma.c +2 -4
@@ -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 );
include/asm-frv/pci.h +2 -5
@@ -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]),
Signature · 1 line
1.6.1.3
PATCH 13/25 BUG to BUG_ON changes
--- arch/blackfin/include/asm/pci.h | 22 ++++++---------------- 1 files changed, 6 insertions(+), 16 deletions(-)
arch/blackfin/include/asm/pci.h +6 -16
@@ -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 */ }
Signature · 1 line
1.6.1.3
PATCH 14/25 BUG to BUG_ON changes
--- mm/nommu.c | 15 +++++---------- 1 files changed, 5 insertions(+), 10 deletions(-)
mm/nommu.c +5 -10
@@ -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; }
Signature · 1 line
1.6.1.3
PATCH 15/25 BUG to BUG_ON changes
--- arch/cris/mm/init.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
arch/cris/mm/init.c +1 -2
@@ -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...
Signature · 1 line
1.6.1.3
PATCH 16/25 BUG to BUG_ON changes
--- arch/m32r/kernel/setup.c | 3 +-- arch/m32r/kernel/smp.c | 9 +++------ 2 files changed, 4 insertions(+), 8 deletions(-)
arch/m32r/kernel/setup.c +1 -2
@@ -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 ;
arch/m32r/kernel/smp.c +3 -6
@@ -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];
Signature · 1 line
1.6.1.3
PATCH 17/25 BUG to BUG_ON changes
--- arch/parisc/kernel/pci-dma.c | 12 ++++-------- 1 files changed, 4 insertions(+), 8 deletions(-)
arch/parisc/kernel/pci-dma.c +4 -8
@@ -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, instatic 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); }
Signature · 1 line
1.6.1.3
PATCH 18/25 BUG to BUG_ON changes
--- arch/xtensa/kernel/pci-dma.c | 9 +++------ 1 files changed, 3 insertions(+), 6 deletions(-)
arch/xtensa/kernel/pci-dma.c +3 -6
@@ -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)); }
Signature · 1 line
1.6.1.3
PATCH 19/25 BUG to BUG_ON changes
--- kernel/sysctl.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
kernel/sysctl.c +1 -2
@@ -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 );
Signature · 1 line
1.6.1.3
PATCH 20/25 BUG to BUG_ON changes
--- drivers/scsi/lpfc/lpfc_els.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/scsi/lpfc/lpfc_els.c +1 -2
@@ -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 :
Signature · 1 line
1.6.1.3
PATCH 21/25 BUG to BUG_ON changes
--- fs/afs/netdevices.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
fs/afs/netdevices.c +1 -2
@@ -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 );
Signature · 1 line
1.6.1.3
PATCH 22/25 BUG to BUG_ON changes
--- include/linux/reiserfs_fs.h | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
include/linux/reiserfs_fs.h +1 -2
@@ -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 ; }
Signature · 1 line
1.6.1.3
PATCH 23/25 BUG to BUG_ON changes
--- drivers/misc/sgi-gru/grukservices.c | 3 +-- drivers/misc/sgi-gru/grumain.c | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/misc/sgi-gru/grukservices.c +1 -2
@@ -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 ();
drivers/misc/sgi-gru/grumain.c +1 -2
@@ -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)
Signature · 1 line
1.6.1.3
PATCH 24/25 BUG to BUG_ON changes
--- drivers/crypto/ixp4xx_crypto.c | 4 +--- 1 files changed, 1 insertions(+), 3 deletions(-)
drivers/crypto/ixp4xx_crypto.c +1 -3
@@ -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)
Signature · 1 line
1.6.1.3
PATCH 25/25 BUG to BUG_ON changes
--- 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(-)
drivers/ata/pata_hpt366.c +1 -2
@@ -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
drivers/base/iommu.c +1 -3
@@ -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; }
drivers/gpu/drm/i915/intel_fb.c +2 -4
@@ -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 ); } }
drivers/mtd/ssfdc.c +1 -2
@@ -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];
drivers/sh/intc.c +1 -2
@@ -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; }
Signature · 1 line
1.6.1.3
Quoted 5 lines · Stoyan Gaydarov
Subject: [PATCH 21/25] [afs] BUG to
BUG_ONchanges
Date: Tue, 10 Mar 2009 00:10:46 -0500
X-RedHat-Spam-Score: -1.333Signed-off-by Stoyan Gaydarov <[email protected]>
Quoted 2 lines · Stoyan Gaydarov
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
From: Stoyan Gaydarov <[email protected]>
Date: Tue, 10 Mar 2009 00:10:41 -0500
Quoted 1 line
Signed-off-by Stoyan Gaydarov <[email protected]>
Quoted 21 lines · Stoyan Gaydarov
Signed-off-by Stoyan Gaydarov <[email protected]>--- arch/cris/mm/init.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)arch/cris/mm/init.c +1
-2@@ -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... Signature · 1 line
1.6.1.3
Thanks, adding it to the CRIS tree.
/^JN - Jesper Nilsson
Signature · 1 line
Jesper Nilsson -- [email protected]
Quoted 5 lines · Stoyan Gaydarov
Subject: [PATCH 12/25] [frv] BUG to
BUG_ONchanges
Date: Tue, 10 Mar 2009 00:10:37 -0500
X-RedHat-Spam-Score: -1.333Signed-off-by Stoyan Gaydarov <[email protected]>
Quoted 5 lines · Stoyan Gaydarov
Subject: [PATCH 10/25] [mn10300] BUG to
BUG_ONchanges
Date: Tue, 10 Mar 2009 00:10:35 -0500
X-RedHat-Spam-Score: 0Signed-off-by Stoyan Gaydarov <[email protected]>
Am Tuesday 10 March 2009 06:10:34 schrieb Stoyan Gaydarov:
drivers/s390/char/tape_std.c tape_std_assign_timeout(unsigned long data) · line 46
Quoted 12 lines
+++
b/drivers/s390/char/tape_std.cdrivers/s390/char/tape_std.c +2
-2@@ -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: Stoyan Gaydarov <[email protected]>
Date: Tue, 10 Mar 2009 00:10:33 -0500
Quoted 1 line
Signed-off-by Stoyan Gaydarov <[email protected]>
Ingo Molnar
AppliedQuoted 6 lines · Stoyan Gaydarov
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();
[tip:x86/debug] x86: BUG to BUG_ON changes
In reply to Stoyan GaydarovCommit-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
LKML-Reference: <[email protected]>
--- arch/x86/kernel/cpu/common.c | 6 ++---- arch/x86/kernel/quirks.c | 3 +-- 2 files changed, 3 insertions(+), 6 deletions(-)
arch/x86/kernel/cpu/common.c +2 -4
@@ -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);
arch/x86/kernel/quirks.c +1 -2
@@ -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 );
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
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(-)
arch/mips/jazz/jazzdma.c +1 -2
@@ -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);
arch/mips/kernel/traps.c +1 -2
@@ -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;
arch/mips/mm/highmem.c +3 -6
@@ -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
arch/mips/mm/init.c +1 -2
@@ -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 ; }
arch/mips/mm/ioremap.c +3 -6
@@ -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;
From: Stoyan Gaydarov <[email protected]>
Date: Tue, 10 Mar 2009 00:10:28 -0500
Quoted 1 line
Signed-off-by Stoyan Gaydarov <[email protected]>
Alexey Dobriyan
NAKdrivers/net/pppol2tp.c static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel) · line 1225
Quoted 9 lines · Stoyan Gaydarov
drivers/net/pppol2tp.c +1
-2@@ -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.
Quoted 2 lines
drivers/net/pppol2tp.c +0
-0PRINTK (tunnel->debug,PPPOL2TP_MSG_CONTROL ,KERN_INFO ,"%s: closing all sessions...\n" , tunnel->name);
David Miller
maintainerFrom: Alexey Dobriyan <[email protected]>
Date: Tue, 10 Mar 2009 13:23:55 +0300
Quoted 7 lines · Stoyan Gaydarov
Quoted 6 lines
drivers/net/pppol2tp.c +0
-0@@ -1222,8 +1222,7 @@ static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel)struct pppol2tp_session *session;struct sock *sk;
Quoted 5 lines
drivers/net/pppol2tp.c static void pppol2tp_tunnel_closeall(struct pppol2tp_tunnel *tunnel) · line 1225
Quoted 3 lines
drivers/net/pppol2tp.c +1
-2-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.
Quoted 15 lines · Stoyan Gaydarov
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(-)drivers/net/ixgb/ixgb_osdep.h +0
-0
drivers/net/ixgb/ixgb_osdep.h line 46
Quoted 8 lines
drivers/net/ixgb/ixgb_osdep.h +1
-1@@ -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
drivers/staging/usbip/vhci_sysfs.c static ssize_t show_status(struct device *dev, struct device_attribute *attr, · line 34
Quoted 9 lines · Stoyan Gaydarov
drivers/staging/usbip/vhci_sysfs.c +1
-2@@ -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.
Quoted 1 line
drivers/staging/usbip/vhci_sysfs.c +0
-0spin_lock (&the_controller->lock);
Quoted 13 lines · Stoyan Gaydarov
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(-)fs/btrfs/ctree.c +0
-0
fs/btrfs/ctree.c static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_root · line 2179
Quoted 8 lines
fs/btrfs/ctree.c +1
-2@@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_rootBUG_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.
Quoted 43 lines
fs/btrfs/ctree.c +0
-0if (slot != nritems) {fs/btrfs/extent-tree.c +1
-2@@ -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++) {fs/btrfs/free-space-cache.c +1
-2@@ -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);fs/btrfs/tree-log.c +1
-2@@ -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 4:16 AM, David John <[email protected]> wrote= :
Quoted 4 lines
Quoted 3 lines · Stoyan Gaydarov
Signed-off-by Stoyan Gaydarov <[email protected]>---
=C2=A0fs/btrfs/ctree.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0| =C2=
=A0 =C2=A03 +--
Quoted 1 line
Quoted 1 line
=C2=A0fs/btrfs/extent-tree.c =C2=A0 =C2=A0 =C2=A0| =C2=A0 =C2=A03 +-=
-
Quoted 2 lines
Quoted 2 lines
=C2=A0fs/btrfs/free-space-cache.c | =C2=A0 =C2=A03 +-- =C2=A0fs/btrfs/tree-log.c =C2=A0 =C2=A0 =C2=A0 =C2=A0 | =C2=A0 =C2=A0=
3 +--
Quoted 7 lines
fs/btrfs/ctree.c static int insert_ptr(struct btrfs_trans_handl=
Quoted 7 lines
=C2=A04 files changed, 4 insertions(+), 8 deletions(-)
fs/btrfs/ctree.c +0
-0@@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handl=
e *trans, struct btrfs_root
Quoted 7 lines
Quoted 7 lines
fs/btrfs/ctree.c +1
-2=C2=A0 =C2=A0 =C2=A0 BUG_ON(!path->nodes[level]); =C2=A0 =C2=A0 =C2=A0 lower =3D path->nodes[level]; =C2=A0 =C2=A0 =C2=A0 nritems =3D btrfs_header_nritems(lower); - =C2=A0 =C2=A0 if (slot > nritems) - =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BUG(); + =C2=A0 =C2=A0 BUG_ON(slot > nritems);=C2=A0 =C2=A0 =C2=A0 if (nritems =3D=3D BTRFS_NODEPTRS_PER_BLOCK(roo=
t))
Quoted 3 lines
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
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.
Quoted 7 lines
fs/btrfs/extent-tree.c static noinline int insert_extents(struct btrfs_=
Quoted 7 lines
=C2=A0 =C2=A0 =C2=A0 if (slot !=3D nritems) {
fs/btrfs/extent-tree.c +0
-0@@ -672,8 +672,7 @@ static noinline int insert_extents(struct btrfs_=
trans_handle *trans,
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =
=C2=A0 =C2=A0 keys+i, data_size+i, total-i);
Quoted 4 lines
Quoted 4 lines
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
BUG_ON(ret < 0);- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (last && ret > 1)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 BUG();
Quoted 3 lines
Quoted 3 lines
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0
BUG_ON(last && ret > 1);=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 leaf =3D path->node=
s[0];
Quoted 1 line
Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 for (c =3D 0; c < r=
et; c++) {
Quoted 1 line
fs/btrfs/free-space-cache=
Quoted 1 line
fs/btrfs/free-space-cache= renamed from fs/btrfs/free-space-cache.c +0
-0
=2Ec
Quoted 4 lines
fs/btrfs/free-space-cache.c static int __btrfs_add_free_space(struct btrfs_b=
Quoted 4 lines
index d1e5f0e..b0c7661 100644
fs/btrfs/free-space-cache.c +0
-0@@ -267,8 +267,7 @@ static int __btrfs_add_free_space(struct btrfs_b=
lock_group_cache *block_group,
Quoted 3 lines
Quoted 3 lines
=C2=A0out:
=C2=A0 =C2=A0 =C2=A0 if (ret) {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 printk(KERN_ERR "bt=
rfs: unable to add free space :%d\n", ret);
Quoted 2 lines
Quoted 2 lines
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 if (ret =3D=3D
-EEXIST)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=
=A0 BUG();
Quoted 1 line
Quoted 1 line
+ =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 BUG_ON(ret =3D=3D -EEXIS=
T);
Quoted 11 lines
Quoted 9 lines
=C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0
kfree(alloc_info);fs/btrfs/tree-log.c +0
-0@@ -1150,8 +1150,7 @@ insert:=C2=A0 =C2=A0 =C2=A0 ret =3D insert_one_name(trans, root, path, key-=
objectid,
key->offset,Quoted 1 line
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0=
=C2=A0 =C2=A0 =C2=A0 =C2=A0 name, name_len, log_type, &log_key);
Quoted 9 lines
Quoted 7 lines
- =C2=A0 =C2=A0 if (ret && ret !=3D
-ENOENT)
- =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0BUG();
+ =C2=A0 =C2=A0BUG_ON(ret && ret !=3D -ENOENT); =C2=A0 =C2=A0 =C2=A0 goto out;
=C2=A0}
--=20
-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
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
if (nritems ==
BTRFS_NODEPTRS_PER_BLOCK(root))BUG();^ You seem to have missed one.
Actually that one was left on purpose because
BUG_ONcalls are not to have any side effects and I do not know enough about btrfs to know whatBTRFS_NODEPTRS_PER_BLOCKdoes 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
Quoted 88 lines · David John
Quoted 9 lines
Quoted 8 lines · Stoyan Gaydarov
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(-)Quoted 16 lines
Quoted 5 lines
fs/btrfs/ctree.c +0
-0fs/btrfs/ctree.c static int insert_ptr(struct btrfs_trans_handle · line 2180
Quoted 9 lines
fs/btrfs/ctree.c +1
-2@@ -2174,8 +2174,7 @@ static int insert_ptr(struct btrfs_trans_handle *trans, struct btrfs_rootBUG_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_ONcalls are not to have any side effects and I do not know enough about btrfs to know whatBTRFS_NODEPTRS_PER_BLOCKdoes so it was left as is.Quoted 48 lines
Quoted 46 lines
if (slot != nritems) {
fs/btrfs/extent-tree.c +1
-2@@ -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++) {
fs/btrfs/free-space-cache.c +0
-0@@ -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);fs/btrfs/tree-log.c +1
-2@@ -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; }Signature · 5 lines
-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
Quoted 8 lines · Stoyan Gaydarov
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