* [KJ] [Patch] BUG_ON() Conversion in drivers/block/
@ 2006-02-01 0:27 Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/ide/ Eric Sesterhenn / snakebyte
` (12 more replies)
0 siblings, 13 replies; 14+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2006-02-01 0:27 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 2039 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc1-git4/drivers/block/cciss.c.orig 2006-01-31 21:31:55.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/block/cciss.c 2006-01-31 21:32:10.000000000 +0100
@@ -2361,8 +2361,7 @@ queue:
if (!creq)
goto startio;
- if (creq->nr_phys_segments > MAXSGENTRIES)
- BUG();
+ BUG_ON(creq->nr_phys_segments > MAXSGENTRIES);
if (( c = cmd_alloc(h, 1)) == NULL)
goto full;
--- linux-2.6.16-rc1-git4/drivers/block/cciss_scsi.c.orig 2006-01-31 21:27:30.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/block/cciss_scsi.c 2006-01-31 21:27:58.000000000 +0100
@@ -1316,7 +1316,7 @@ cciss_scsi_queue_command (struct scsi_cm
cp->Request.Timeout = 0;
memset(cp->Request.CDB, 0, sizeof(cp->Request.CDB));
- if (cmd->cmd_len > sizeof(cp->Request.CDB)) BUG();
+ BUG_ON(cmd->cmd_len > sizeof(cp->Request.CDB));
cp->Request.CDBLen = cmd->cmd_len;
memcpy(cp->Request.CDB, cmd->cmnd, cmd->cmd_len);
cp->Request.Type.Type = TYPE_CMD;
--- linux-2.6.16-rc1-git4/drivers/block/cpqarray.c.orig 2006-01-31 21:32:23.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/block/cpqarray.c 2006-01-31 21:32:33.000000000 +0100
@@ -910,8 +910,7 @@ queue_next:
if (!creq)
goto startio;
- if (creq->nr_phys_segments > SG_MAX)
- BUG();
+ BUG_ON(creq->nr_phys_segments > SG_MAX);
if ((c = cmd_alloc(h,1)) == NULL)
goto startio;
--- linux-2.6.16-rc1-git4/drivers/block/DAC960.c.orig 2006-01-31 21:32:48.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/block/DAC960.c 2006-01-31 21:33:07.000000000 +0100
@@ -229,8 +229,7 @@ static void *slice_dma_loaf(struct dma_l
void *cpu_end = loaf->cpu_free + len;
void *cpu_addr = loaf->cpu_free;
- if (cpu_end > loaf->cpu_base + loaf->length)
- BUG();
+ BUG_ON(cpu_end > loaf->cpu_base + loaf->length);
*dma_handle = loaf->dma_free;
loaf->cpu_free = cpu_end;
loaf->dma_free += len;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/ide/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
@ 2006-02-01 0:28 ` Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/media/ Eric Sesterhenn / snakebyte
` (11 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2006-02-01 0:28 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 6592 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc1-git4/drivers/ide/ide.c.orig 2006-01-31 21:09:17.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide.c 2006-01-31 21:10:49.000000000 +0100
@@ -1367,8 +1367,7 @@ int generic_ide_ioctl(ide_drive_t *drive
ide_abort(drive, "drive reset");
- if(HWGROUP(drive)->handler)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler);
/* Ensure nothing gets queued after we
drop the lock. Reset will clear the busy */
--- linux-2.6.16-rc1-git4/drivers/ide/ide-cd.c.orig 2006-01-31 21:13:27.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide-cd.c 2006-01-31 21:13:39.000000000 +0100
@@ -1721,8 +1721,7 @@ static ide_startstop_t cdrom_newpc_intr(
}
}
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, NULL);
return ide_started;
--- linux-2.6.16-rc1-git4/drivers/ide/ide-dma.c.orig 2006-01-31 21:11:13.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide-dma.c 2006-01-31 21:11:35.000000000 +0100
@@ -206,8 +206,7 @@ int ide_build_sglist(ide_drive_t *drive,
ide_hwif_t *hwif = HWIF(drive);
struct scatterlist *sg = hwif->sg_table;
- if ((rq->flags & REQ_DRIVE_TASKFILE) && rq->nr_sectors > 256)
- BUG();
+ BUG_ON((rq->flags & REQ_DRIVE_TASKFILE) && rq->nr_sectors > 256);
ide_map_sg(drive, rq);
@@ -947,8 +946,7 @@ void ide_setup_dma (ide_hwif_t *hwif, un
}
printk("\n");
- if (!(hwif->dma_master))
- BUG();
+ BUG_ON(!(hwif->dma_master));
}
EXPORT_SYMBOL_GPL(ide_setup_dma);
--- linux-2.6.16-rc1-git4/drivers/ide/ide-floppy.c.orig 2006-01-31 21:12:15.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide-floppy.c 2006-01-31 21:13:19.000000000 +0100
@@ -897,8 +897,7 @@ static ide_startstop_t idefloppy_pc_intr
"to send us more data than expected "
"- discarding data\n");
idefloppy_discard_data(drive,bcount.all);
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive,
&idefloppy_pc_intr,
IDEFLOPPY_WAIT_CMD,
@@ -931,8 +930,7 @@ static ide_startstop_t idefloppy_pc_intr
pc->actually_transferred += bcount.all;
pc->current_position += bcount.all;
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started;
}
@@ -959,8 +957,7 @@ static ide_startstop_t idefloppy_transfe
"issuing a packet command\n");
return ide_do_reset(drive);
}
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
/* Set the interrupt routine */
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
/* Send the actual packet */
@@ -1016,8 +1013,7 @@ static ide_startstop_t idefloppy_transfe
* 40 and 50msec work well. idefloppy_pc_intr will not be actually
* used until after the packet is moved in about 50 msec.
*/
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive,
&idefloppy_pc_intr, /* service routine for packet command */
floppy->ticks, /* wait this long before "failing" */
--- linux-2.6.16-rc1-git4/drivers/ide/ide-iops.c.orig 2006-01-31 21:13:48.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide-iops.c 2006-01-31 21:14:28.000000000 +0100
@@ -939,8 +939,7 @@ void ide_execute_command(ide_drive_t *dr
spin_lock_irqsave(&ide_lock, flags);
- if(hwgroup->handler)
- BUG();
+ BUG_ON(hwgroup->handler);
hwgroup->handler = handler;
hwgroup->expiry = expiry;
hwgroup->timer.expires = jiffies + timeout;
@@ -981,8 +980,7 @@ static ide_startstop_t atapi_reset_pollf
printk("%s: ATAPI reset complete\n", drive->name);
} else {
if (time_before(jiffies, hwgroup->poll_timeout)) {
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
/* continue polling */
return ide_started;
@@ -1021,8 +1019,7 @@ static ide_startstop_t reset_pollfunc (i
if (!OK_STAT(tmp = hwif->INB(IDE_STATUS_REG), 0, BUSY_STAT)) {
if (time_before(jiffies, hwgroup->poll_timeout)) {
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL);
/* continue polling */
return ide_started;
@@ -1138,8 +1135,7 @@ static ide_startstop_t do_reset1 (ide_dr
hwgroup = HWGROUP(drive);
/* We must not reset with running handlers */
- if(hwgroup->handler != NULL)
- BUG();
+ BUG_ON(hwgroup->handler != NULL);
/* For an ATAPI device, first try an ATAPI SRST. */
if (drive->media != ide_disk && !do_not_try_atapi) {
--- linux-2.6.16-rc1-git4/drivers/ide/ide-lib.c.orig 2006-01-31 21:14:38.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide-lib.c 2006-01-31 21:14:48.000000000 +0100
@@ -164,8 +164,7 @@ u8 ide_rate_filter (u8 mode, u8 speed)
// printk("%s: mode 0x%02x, speed 0x%02x\n", __FUNCTION__, mode, speed);
/* So that we remember to update this if new modes appear */
- if (mode > 4)
- BUG();
+ BUG_ON(mode > 4);
return min(speed, speed_max[mode]);
#else /* !CONFIG_BLK_DEV_IDEDMA */
return min(speed, (u8)XFER_PIO_4);
--- linux-2.6.16-rc1-git4/drivers/ide/ide-taskfile.c.orig 2006-01-31 21:11:48.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/ide-taskfile.c 2006-01-31 21:12:04.000000000 +0100
@@ -195,8 +195,7 @@ ide_startstop_t set_geometry_intr (ide_d
if (stat & (ERR_STAT|DRQ_STAT))
return ide_error(drive, "set_geometry_intr", stat);
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &set_geometry_intr, WAIT_WORSTCASE, NULL);
return ide_started;
}
--- linux-2.6.16-rc1-git4/drivers/ide/pci/trm290.c.orig 2006-01-31 21:15:10.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/ide/pci/trm290.c 2006-01-31 21:15:27.000000000 +0100
@@ -183,8 +183,7 @@ static void trm290_ide_dma_exec_cmd(ide_
{
ide_hwif_t *hwif = HWIF(drive);
- if (HWGROUP(drive)->handler != NULL) /* paranoia check */
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
/* issue cmd to drive */
hwif->OUTB(command, IDE_COMMAND_REG);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/media/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/ide/ Eric Sesterhenn / snakebyte
@ 2006-02-01 0:28 ` Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/parisc/ Eric Sesterhenn / snakebyte
` (10 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2006-02-01 0:28 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 6673 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-alsa.c.orig 2006-01-31 21:49:07.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-alsa.c 2006-01-31 21:49:18.000000000 +0100
@@ -306,8 +306,7 @@ static int dsp_buffer_init(struct saa713
static int dsp_buffer_free(struct saa7134_dev *dev)
{
- if (!dev->dmasound.blksize)
- BUG();
+ BUG_ON(!dev->dmasound.blksize);
videobuf_dma_free(&dev->dmasound.dma);
--- linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-oss.c.orig 2006-01-31 21:49:27.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-oss.c 2006-01-31 21:49:42.000000000 +0100
@@ -84,8 +84,7 @@ static int dsp_buffer_init(struct saa713
{
int err;
- if (!dev->dmasound.bufsize)
- BUG();
+ BUG_ON(!dev->dmasound.bufsize);
videobuf_dma_init(&dev->dmasound.dma);
err = videobuf_dma_init_kernel(&dev->dmasound.dma, PCI_DMA_FROMDEVICE,
(dev->dmasound.bufsize + PAGE_SIZE) >> PAGE_SHIFT);
@@ -96,8 +95,7 @@ static int dsp_buffer_init(struct saa713
static int dsp_buffer_free(struct saa7134_dev *dev)
{
- if (!dev->dmasound.blksize)
- BUG();
+ BUG_ON(!dev->dmasound.blksize);
videobuf_dma_free(&dev->dmasound.dma);
dev->dmasound.blocks = 0;
dev->dmasound.blksize = 0;
--- linux-2.6.16-rc1-git4/drivers/media/video/bttv-risc.c.orig 2006-01-31 21:49:57.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/bttv-risc.c 2006-01-31 21:50:08.000000000 +0100
@@ -507,8 +507,7 @@ bttv_risc_hook(struct bttv *btv, int slo
void
bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf)
{
- if (in_interrupt())
- BUG();
+ BUG_ON(in_interrupt());
videobuf_waiton(&buf->vb,0,0);
videobuf_dma_pci_unmap(btv->c.pci, &buf->vb.dma);
videobuf_dma_free(&buf->vb.dma);
--- linux-2.6.16-rc1-git4/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c.orig 2006-01-31 21:42:27.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c 2006-01-31 21:42:38.000000000 +0100
@@ -689,8 +689,7 @@ static void ttusb_process_frame(struct t
memcpy(ttusb->muxpack + ttusb->muxpack_ptr,
data, avail);
ttusb->muxpack_ptr += avail;
- if (ttusb->muxpack_ptr > 264)
- BUG();
+ BUG_ON(ttusb->muxpack_ptr > 264);
data += avail;
len -= avail;
/* determine length */
--- linux-2.6.16-rc1-git4/drivers/media/dvb/ttpci/av7110.c.orig 2006-01-31 21:42:57.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/dvb/ttpci/av7110.c 2006-01-31 21:43:24.000000000 +0100
@@ -1088,11 +1088,9 @@ static int dvb_get_stc(struct dmx_demux
struct av7110 *av7110;
/* pointer casting paranoia... */
- if (!demux)
- BUG();
+ BUG_ON(!demux);
dvbdemux = (struct dvb_demux *) demux->priv;
- if (!dvbdemux)
- BUG();
+ BUG_ON(!dvbdemux);
av7110 = (struct av7110 *) dvbdemux->priv;
dprintk(4, "%p\n", av7110);
--- linux-2.6.16-rc1-git4/drivers/media/common/saa7146_fops.c.orig 2006-01-31 21:43:43.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/common/saa7146_fops.c 2006-01-31 21:44:06.000000000 +0100
@@ -37,8 +37,7 @@ void saa7146_res_free(struct saa7146_fh
struct saa7146_dev *dev = fh->dev;
struct saa7146_vv *vv = dev->vv_data;
- if ((fh->resources & bits) != bits)
- BUG();
+ BUG_ON((fh->resources & bits) != bits);
down(&dev->lock);
fh->resources &= ~bits;
@@ -55,8 +54,7 @@ void saa7146_dma_free(struct saa7146_dev
{
DEB_EE(("dev:%p, buf:%p\n",dev,buf));
- if (in_interrupt())
- BUG();
+ BUG_ON(in_interrupt());
videobuf_waiton(&buf->vb,0,0);
videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma);
--- linux-2.6.16-rc1-git4/drivers/media/common/saa7146_core.c.orig 2006-01-31 21:44:16.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/common/saa7146_core.c 2006-01-31 21:45:45.000000000 +0100
@@ -116,8 +116,7 @@ static struct scatterlist* vmalloc_to_sg
pg = vmalloc_to_page(virt);
if (NULL == pg)
goto err;
- if (PageHighMem(pg))
- BUG();
+ BUG_ON(PageHighMem(pg));
sglist[i].page = pg;
sglist[i].length = PAGE_SIZE;
}
--- linux-2.6.16-rc1-git4/drivers/media/video/video-buf.c.orig 2006-01-31 21:46:05.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/video-buf.c 2006-01-31 21:46:28.000000000 +0100
@@ -59,8 +59,7 @@ videobuf_vmalloc_to_sg(unsigned char *vi
pg = vmalloc_to_page(virt);
if (NULL == pg)
goto err;
- if (PageHighMem(pg))
- BUG();
+ BUG_ON(PageHighMem(pg));
sglist[i].page = pg;
sglist[i].length = PAGE_SIZE;
}
--- linux-2.6.16-rc1-git4/drivers/media/video/cx88/cx88-core.c.orig 2006-01-31 21:46:48.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/cx88/cx88-core.c 2006-01-31 21:46:58.000000000 +0100
@@ -215,8 +215,7 @@ int cx88_risc_stopper(struct pci_dev *pc
void
cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf)
{
- if (in_interrupt())
- BUG();
+ BUG_ON(in_interrupt());
videobuf_waiton(&buf->vb,0,0);
videobuf_dma_pci_unmap(pci, &buf->vb.dma);
videobuf_dma_free(&buf->vb.dma);
--- linux-2.6.16-rc1-git4/drivers/media/video/cx88/cx88-video.c.orig 2006-01-31 21:47:11.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/cx88/cx88-video.c 2006-01-31 21:47:31.000000000 +0100
@@ -366,8 +366,7 @@ static
void res_free(struct cx8800_dev *dev, struct cx8800_fh *fh, unsigned int bits)
{
struct cx88_core *core = dev->core;
- if ((fh->resources & bits) != bits)
- BUG();
+ BUG_ON((fh->resources & bits) != bits);
down(&core->lock);
fh->resources &= ~bits;
--- linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-video.c.orig 2006-01-31 21:48:05.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-video.c 2006-01-31 21:48:24.000000000 +0100
@@ -489,8 +489,7 @@ int res_locked(struct saa7134_dev *dev,
static
void res_free(struct saa7134_dev *dev, struct saa7134_fh *fh, unsigned int bits)
{
- if ((fh->resources & bits) != bits)
- BUG();
+ BUG_ON((fh->resources & bits) != bits);
down(&dev->lock);
fh->resources &= ~bits;
--- linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-core.c.orig 2006-01-31 21:48:34.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/media/video/saa7134/saa7134-core.c 2006-01-31 21:48:44.000000000 +0100
@@ -251,8 +251,7 @@ void saa7134_pgtable_free(struct pci_dev
void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf)
{
- if (in_interrupt())
- BUG();
+ BUG_ON(in_interrupt());
videobuf_waiton(&buf->vb,0,0);
videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/parisc/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/ide/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/media/ Eric Sesterhenn / snakebyte
@ 2006-02-01 0:28 ` Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/video/ Eric Sesterhenn / snakebyte
` (9 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2006-02-01 0:28 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 2140 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc1-git4/drivers/parisc/sba_iommu.c.orig 2006-01-31 21:36:12.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/parisc/sba_iommu.c 2006-01-31 21:36:59.000000000 +0100
@@ -1722,9 +1722,7 @@ printk("sba_hw_init(): mem_boot 0x%x 0x%
sba_dev->chip_resv.start = PCI_F_EXTEND | 0xfef00000UL;
sba_dev->chip_resv.end = PCI_F_EXTEND | (0xff000000UL - 1) ;
err = request_resource(&iomem_resource, &(sba_dev->chip_resv));
- if (err < 0) {
- BUG();
- }
+ BUG_ON(err < 0);
} else if (IS_PLUTO(sba_dev->iodc)) {
int err;
@@ -2155,8 +2153,7 @@ void sba_directed_lmmio(struct parisc_de
int i;
int rope = (pci_hba->hw_path & (ROPES_PER_IOC-1)); /* rope # */
- if ((t!=HPHW_IOA) && (t!=HPHW_BCPORT))
- BUG();
+ BUG_ON((t!=HPHW_IOA) && (t!=HPHW_BCPORT));
r->start = r->end = 0;
@@ -2198,8 +2195,7 @@ void sba_distributed_lmmio(struct parisc
int base, size;
int rope = (pci_hba->hw_path & (ROPES_PER_IOC-1)); /* rope # */
- if ((t!=HPHW_IOA) && (t!=HPHW_BCPORT))
- BUG();
+ BUG_ON((t!=HPHW_IOA) && (t!=HPHW_BCPORT));
r->start = r->end = 0;
--- linux-2.6.16-rc1-git4/drivers/parisc/superio.c.orig 2006-01-31 21:37:17.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/parisc/superio.c 2006-01-31 21:38:31.000000000 +0100
@@ -154,8 +154,8 @@ superio_init(struct pci_dev *pcidev)
if (sio->suckyio_irq_enabled)
return;
- if (!pdev) BUG();
- if (!sio->usb_pdev) BUG();
+ BUG_ON(!pdev);
+ BUG_ON(!sio->usb_pdev);
/* use the IRQ iosapic found for USB INT D... */
pdev->irq = sio->usb_pdev->irq;
@@ -471,8 +471,7 @@ superio_probe(struct pci_dev *dev, const
dev->subsystem_vendor, dev->subsystem_device,
dev->class);
- if (!sio->suckyio_irq_enabled)
- BUG(); /* Enabled by PCI_FIXUP_FINAL */
+ BUG_ON(!sio->suckyio_irq_enabled); /* Enabled by PCI_FIXUP_FINAL */
if (dev->device == PCI_DEVICE_ID_NS_87560_LIO) { /* Function 1 */
superio_parport_init();
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/video/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (2 preceding siblings ...)
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/parisc/ Eric Sesterhenn / snakebyte
@ 2006-02-01 0:28 ` Eric Sesterhenn / snakebyte
2006-02-07 21:52 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Eric Sesterhenn
` (8 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn / snakebyte @ 2006-02-01 0:28 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc1-git4/drivers/video/bw2.c.orig 2006-01-31 21:40:21.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/video/bw2.c 2006-01-31 21:40:38.000000000 +0100
@@ -327,8 +327,7 @@ static void bw2_init_one(struct sbus_dev
} else
#else
{
- if (!sdev)
- BUG();
+ BUG_ON(!sdev);
all->par.physbase = sdev->reg_addrs[0].phys_addr;
resp = &sdev->resource[0];
sbusfb_fill_var(&all->info.var, (sdev ? sdev->prom_node : 0), 1);
--- linux-2.6.16-rc1-git4/drivers/video/ffb.c.orig 2006-01-31 21:41:06.000000000 +0100
+++ linux-2.6.16-rc1-git4/drivers/video/ffb.c 2006-01-31 21:41:21.000000000 +0100
@@ -466,8 +466,7 @@ static void ffb_fillrect(struct fb_info
unsigned long flags;
u32 fg;
- if (rect->rop != ROP_COPY && rect->rop != ROP_XOR)
- BUG();
+ BUG_ON(rect->rop != ROP_COPY && rect->rop != ROP_XOR);
fg = ((u32 *)info->pseudo_palette)[rect->color];
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/net/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (3 preceding siblings ...)
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/video/ Eric Sesterhenn / snakebyte
@ 2006-02-07 21:52 ` Eric Sesterhenn
2006-02-07 22:02 ` [KJ] [Patch] BUG_ON() Conversion in drivers/mtd/ Eric Sesterhenn
` (7 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn @ 2006-02-07 21:52 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 9744 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc2-git2/drivers/net/e1000/e1000_main.c.orig 2006-02-07 21:40:27.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/e1000/e1000_main.c 2006-02-07 21:40:45.000000000 +0100
@@ -3419,8 +3419,7 @@ e1000_clean(struct net_device *poll_dev,
while (poll_dev != &adapter->polling_netdev[i]) {
i++;
- if (unlikely(i == adapter->num_rx_queues))
- BUG();
+ BUG_ON(i == adapter->num_rx_queues);
}
if (likely(adapter->num_tx_queues == 1)) {
--- linux-2.6.16-rc2-git2/drivers/net/tg3.c.orig 2006-02-07 21:41:02.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/tg3.c 2006-02-07 21:42:54.000000000 +0100
@@ -1038,8 +1038,7 @@ static void tg3_frob_aux_power(struct tg
struct net_device *dev_peer;
dev_peer = pci_get_drvdata(tp->pdev_peer);
- if (!dev_peer)
- BUG();
+ BUG_ON(!dev_peer);
tp_peer = netdev_priv(dev_peer);
}
@@ -2913,9 +2912,7 @@ static void tg3_tx(struct tg3 *tp)
struct sk_buff *skb = ri->skb;
int i;
- if (unlikely(skb == NULL))
- BUG();
-
+ BUG_ON(skb == NULL);
pci_unmap_single(tp->pdev,
pci_unmap_addr(ri, mapping),
skb_headlen(skb),
@@ -2926,12 +2923,10 @@ static void tg3_tx(struct tg3 *tp)
sw_idx = NEXT_TX(sw_idx);
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
- if (unlikely(sw_idx == hw_idx))
- BUG();
+ BUG_ON(sw_idx == hw_idx);
ri = &tp->tx_buffers[sw_idx];
- if (unlikely(ri->skb != NULL))
- BUG();
+ BUG_ON(ri->skb != NULL);
pci_unmap_page(tp->pdev,
pci_unmap_addr(ri, mapping),
@@ -4715,9 +4710,8 @@ static int tg3_halt_cpu(struct tg3 *tp,
{
int i;
- if (offset == TX_CPU_BASE &&
- (tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
- BUG();
+ BUG_ON(offset == TX_CPU_BASE &&
+ (tp->tg3_flags2 & TG3_FLG2_5705_PLUS));
if (offset == RX_CPU_BASE) {
for (i = 0; i < 10000; i++) {
--- linux-2.6.16-rc2-git2/drivers/net/eql.c.orig 2006-02-07 21:43:10.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/eql.c 2006-02-07 21:43:24.000000000 +0100
@@ -203,8 +203,7 @@ static int eql_open(struct net_device *d
printk(KERN_INFO "%s: remember to turn off Van-Jacobson compression on "
"your slave devices.\n", dev->name);
- if (!list_empty(&eql->queue.all_slaves))
- BUG();
+ BUG_ON(!list_empty(&eql->queue.all_slaves));
eql->min_slaves = 1;
eql->max_slaves = EQL_DEFAULT_MAX_SLAVES; /* 4 usually... */
--- linux-2.6.16-rc2-git2/drivers/net/yellowfin.c.orig 2006-02-07 21:43:33.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/yellowfin.c 2006-02-07 21:43:42.000000000 +0100
@@ -1441,8 +1441,7 @@ static void __devexit yellowfin_remove_o
struct net_device *dev = pci_get_drvdata(pdev);
struct yellowfin_private *np;
- if (!dev)
- BUG();
+ BUG_ON(!dev);
np = netdev_priv(dev);
pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status,
--- linux-2.6.16-rc2-git2/drivers/net/ne2k-pci.c.orig 2006-02-07 21:43:55.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/ne2k-pci.c 2006-02-07 21:44:05.000000000 +0100
@@ -645,9 +645,7 @@ static void __devexit ne2k_pci_remove_on
{
struct net_device *dev = pci_get_drvdata(pdev);
- if (!dev)
- BUG();
-
+ BUG_ON(!dev);
unregister_netdev(dev);
release_region(dev->base_addr, NE_IO_EXTENT);
free_netdev(dev);
--- linux-2.6.16-rc2-git2/drivers/net/irda/sa1100_ir.c.orig 2006-02-07 21:45:11.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/irda/sa1100_ir.c 2006-02-07 21:45:21.000000000 +0100
@@ -695,8 +695,7 @@ static int sa1100_irda_hard_xmit(struct
/*
* We must not be transmitting...
*/
- if (si->txskb)
- BUG();
+ BUG_ON(si->txskb);
netif_stop_queue(dev);
--- linux-2.6.16-rc2-git2/drivers/net/chelsio/sge.c.orig 2006-02-07 21:45:33.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/chelsio/sge.c 2006-02-07 21:45:47.000000000 +0100
@@ -1093,8 +1093,7 @@ static int process_responses(struct adap
if (likely(e->DataValid)) {
struct freelQ *fl = &sge->freelQ[e->FreelistQid];
- if (unlikely(!e->Sop || !e->Eop))
- BUG();
+ BUG_ON(!e->Sop || !e->Eop);
if (unlikely(e->Offload))
unexpected_offload(adapter, fl);
else
--- linux-2.6.16-rc2-git2/drivers/net/b44.c.orig 2006-02-07 21:46:01.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/b44.c 2006-02-07 21:46:11.000000000 +0100
@@ -608,8 +608,7 @@ static void b44_tx(struct b44 *bp)
struct ring_info *rp = &bp->tx_buffers[cons];
struct sk_buff *skb = rp->skb;
- if (unlikely(skb == NULL))
- BUG();
+ BUG_ON(unlikely(skb == NULL);
pci_unmap_single(bp->pdev,
pci_unmap_addr(rp, mapping),
--- linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c.orig 2006-02-07 21:47:52.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c 2006-02-07 21:48:23.000000000 +0100
@@ -761,8 +761,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
BUGMSG(D_DURING, "in arcnet_interrupt\n");
lp = dev->priv;
- if (!lp)
- BUG();
+ BUG_ON(!lp);
spin_lock(&lp->lock);
--- linux-2.6.16-rc2-git2/drivers/net/tokenring/madgemc.c.orig 2006-02-07 21:46:41.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/tokenring/madgemc.c 2006-02-07 21:47:29.000000000 +0100
@@ -735,8 +735,7 @@ static int __devexit madgemc_remove(stru
struct net_local *tp;
struct card_info *card;
- if (!dev)
- BUG();
+ BUG_ON(!dev);
tp = dev->priv;
card = tp->tmspriv;
--- linux-2.6.16-rc2-git2/drivers/net/tokenring/abyss.c.orig 2006-02-07 21:47:36.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/tokenring/abyss.c 2006-02-07 21:47:43.000000000 +0100
@@ -438,8 +438,7 @@ static void __devexit abyss_detach (stru
{
struct net_device *dev = pci_get_drvdata(pdev);
- if (!dev)
- BUG();
+ BUG_ON(!dev);
unregister_netdev(dev);
release_region(dev->base_addr-0x10, ABYSS_IO_EXTENT);
free_irq(dev->irq, dev);
--- linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c.orig 2006-02-07 21:47:52.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c 2006-02-07 21:48:23.000000000 +0100
@@ -761,8 +761,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
BUGMSG(D_DURING, "in arcnet_interrupt\n");
lp = dev->priv;
- if (!lp)
- BUG();
+ BUG_ON(!lp);
spin_lock(&lp->lock);
--- linux-2.6.16-rc2-git2/drivers/net/ns83820.c.orig 2006-02-07 21:49:57.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/ns83820.c 2006-02-07 21:51:04.000000000 +0100
@@ -567,8 +567,7 @@ static inline int ns83820_add_rx_skb(str
#endif
sg = dev->rx_info.descs + (next_empty * DESC_SIZE);
- if (unlikely(NULL != dev->rx_info.skbs[next_empty]))
- BUG();
+ BUG_ON(NULL != dev->rx_info.skbs[next_empty]);
dev->rx_info.skbs[next_empty] = skb;
dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC;
--- linux-2.6.16-rc2-git2/drivers/net/wireless/ipw2200.c.orig 2006-02-07 21:51:20.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/wireless/ipw2200.c 2006-02-07 21:51:57.000000000 +0100
@@ -5603,8 +5603,7 @@ static void ipw_adhoc_create(struct ipw_
case IEEE80211_52GHZ_BAND:
network->mode = IEEE_A;
i = ipw_channel_to_index(priv->ieee, priv->channel);
- if (i == -1)
- BUG();
+ BUG_ON(i == -1);
if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) {
IPW_WARNING("Overriding invalid channel\n");
priv->channel = geo->a[0].channel;
@@ -5617,8 +5616,7 @@ static void ipw_adhoc_create(struct ipw_
else
network->mode = IEEE_B;
i = ipw_channel_to_index(priv->ieee, priv->channel);
- if (i == -1)
- BUG();
+ BUG_ON(i == -1);
if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) {
IPW_WARNING("Overriding invalid channel\n");
priv->channel = geo->bg[0].channel;
@@ -6756,8 +6754,7 @@ static int ipw_qos_association(struct ip
switch (priv->ieee->iw_mode) {
case IW_MODE_ADHOC:
- if (!(network->capability & WLAN_CAPABILITY_IBSS))
- BUG();
+ BUG_ON(!(network->capability & WLAN_CAPABILITY_IBSS));
qos_data = &ibss_data;
break;
--- linux-2.6.16-rc2-git2/drivers/net/8139cp.c.orig 2006-02-07 21:52:12.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/8139cp.c 2006-02-07 21:52:49.000000000 +0100
@@ -539,8 +539,7 @@ rx_status_loop:
unsigned buflen;
skb = cp->rx_skb[rx_tail].skb;
- if (!skb)
- BUG();
+ BUG_ON(!skb);
desc = &cp->rx_ring[rx_tail];
status = le32_to_cpu(desc->opts1);
@@ -723,8 +722,7 @@ static void cp_tx (struct cp_private *cp
break;
skb = cp->tx_skb[tx_tail].skb;
- if (!skb)
- BUG();
+ BUG_ON(!skb);
pci_unmap_single(cp->pdev, cp->tx_skb[tx_tail].mapping,
cp->tx_skb[tx_tail].len, PCI_DMA_TODEVICE);
@@ -1545,8 +1543,7 @@ static void cp_get_ethtool_stats (struct
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
tmp_stats[i++] = cp->cp_stats.rx_frags;
- if (i != CP_NUM_STATS)
- BUG();
+ BUG_ON(i != CP_NUM_STATS);
pci_free_consistent(cp->pdev, sizeof(*nic_stats), nic_stats, dma);
}
@@ -1851,8 +1848,7 @@ static void cp_remove_one (struct pci_de
struct net_device *dev = pci_get_drvdata(pdev);
struct cp_private *cp = netdev_priv(dev);
- if (!dev)
- BUG();
+ BUG_ON(!dev);
unregister_netdev(dev);
iounmap(cp->regs);
if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0);
--- linux-2.6.16-rc2-git2/drivers/net/starfire.c.orig 2006-02-07 21:52:59.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/starfire.c 2006-02-07 21:53:34.000000000 +0100
@@ -2090,8 +2090,7 @@ static void __devexit starfire_remove_on
struct net_device *dev = pci_get_drvdata(pdev);
struct netdev_private *np = netdev_priv(dev);
- if (!dev)
- BUG();
+ BUG_ON(!dev);
unregister_netdev(dev);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/mtd/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (4 preceding siblings ...)
2006-02-07 21:52 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Eric Sesterhenn
@ 2006-02-07 22:02 ` Eric Sesterhenn
2006-02-07 23:24 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Håkon Løvdal
` (6 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn @ 2006-02-07 22:02 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 2026 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc2-git2/drivers/mtd/mtd_blkdevs.c.orig 2006-02-07 22:55:07.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/mtd/mtd_blkdevs.c 2006-02-07 22:56:37.000000000 +0100
@@ -450,8 +450,7 @@ int deregister_mtd_blktrans(struct mtd_b
kfree(tr->blkcore_priv);
- if (!list_empty(&tr->devs))
- BUG();
+ BUG_ON(!list_empty(&tr->devs));
return 0;
}
--- linux-2.6.16-rc2-git2/drivers/mtd/maps/dilnetpc.c.orig 2006-02-07 22:56:46.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/mtd/maps/dilnetpc.c 2006-02-07 22:57:23.000000000 +0100
@@ -218,8 +218,8 @@ static void dnp_set_vpp(struct map_info
{
if(--vpp_counter == 0)
setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x4);
- else if(vpp_counter < 0)
- BUG();
+ else
+ BUG_ON(vpp_counter < 0);
}
spin_unlock_irq(&dnpc_spin);
}
@@ -240,8 +240,8 @@ static void adnp_set_vpp(struct map_info
{
if(--vpp_counter == 0)
setcsc(CSC_RBWR, getcsc(CSC_RBWR) | 0x8);
- else if(vpp_counter < 0)
- BUG();
+ else
+ BUG_ON(vpp_counter < 0);
}
spin_unlock_irq(&dnpc_spin);
}
--- linux-2.6.16-rc2-git2/drivers/mtd/mtdconcat.c.orig 2006-02-07 22:58:05.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/mtd/mtdconcat.c 2006-02-07 22:58:25.000000000 +0100
@@ -477,8 +477,7 @@ static int concat_erase(struct mtd_info
}
/* must never happen since size limit has been verified above */
- if (i >= concat->num_subdev)
- BUG();
+ BUG_ON(i >= concat->num_subdev);
/* now do the erase: */
err = 0;
@@ -500,8 +499,7 @@ static int concat_erase(struct mtd_info
if ((err = concat_dev_erase(subdev, erase))) {
/* sanity check: should never happen since
* block alignment has been checked above */
- if (err == -EINVAL)
- BUG();
+ BUG_ON(err == -EINVAL);
if (erase->fail_addr != 0xffffffff)
instr->fail_addr = erase->fail_addr + offset;
break;
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [KJ] [Patch] BUG_ON() Conversion in drivers/net/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (5 preceding siblings ...)
2006-02-07 22:02 ` [KJ] [Patch] BUG_ON() Conversion in drivers/mtd/ Eric Sesterhenn
@ 2006-02-07 23:24 ` Håkon Løvdal
2006-02-08 11:07 ` Eric Sesterhenn
` (5 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Håkon Løvdal @ 2006-02-07 23:24 UTC (permalink / raw)
To: kernel-janitors
On 2/7/06, Eric Sesterhenn <snakebyte@gmx.de> wrote:
> --- linux-2.6.16-rc2-git2/drivers/net/b44.c.orig 2006-02-07 21:46:01.000000000 +0100
> +++ linux-2.6.16-rc2-git2/drivers/net/b44.c 2006-02-07 21:46:11.000000000 +0100
> @@ -608,8 +608,7 @@ static void b44_tx(struct b44 *bp)
> struct ring_info *rp = &bp->tx_buffers[cons];
> struct sk_buff *skb = rp->skb;
>
> - if (unlikely(skb = NULL))
> - BUG();
> + BUG_ON(unlikely(skb = NULL);
>
> pci_unmap_single(bp->pdev,
> pci_unmap_addr(rp, mapping),
I think unlikely can be removed here.
BR Håkon Løvdal
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [KJ] [Patch] BUG_ON() Conversion in drivers/net/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (6 preceding siblings ...)
2006-02-07 23:24 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Håkon Løvdal
@ 2006-02-08 11:07 ` Eric Sesterhenn
2006-02-09 17:25 ` [KJ] [Patch] BUG_ON() Conversion in drivers/scsi Eric Sesterhenn
` (4 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn @ 2006-02-08 11:07 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 9752 bytes --]
hi,
> I think unlikely can be removed here.
thanks, shouldnt do trivial patches after a day of studying :)
Here is the updated version.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc2-git2/drivers/net/e1000/e1000_main.c.orig 2006-02-07 21:40:27.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/e1000/e1000_main.c 2006-02-07 21:40:45.000000000 +0100
@@ -3419,8 +3419,7 @@ e1000_clean(struct net_device *poll_dev,
while (poll_dev != &adapter->polling_netdev[i]) {
i++;
- if (unlikely(i == adapter->num_rx_queues))
- BUG();
+ BUG_ON(i == adapter->num_rx_queues);
}
if (likely(adapter->num_tx_queues == 1)) {
--- linux-2.6.16-rc2-git2/drivers/net/tg3.c.orig 2006-02-07 21:41:02.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/tg3.c 2006-02-07 21:42:54.000000000 +0100
@@ -1038,8 +1038,7 @@ static void tg3_frob_aux_power(struct tg
struct net_device *dev_peer;
dev_peer = pci_get_drvdata(tp->pdev_peer);
- if (!dev_peer)
- BUG();
+ BUG_ON(!dev_peer);
tp_peer = netdev_priv(dev_peer);
}
@@ -2913,9 +2912,7 @@ static void tg3_tx(struct tg3 *tp)
struct sk_buff *skb = ri->skb;
int i;
- if (unlikely(skb == NULL))
- BUG();
-
+ BUG_ON(skb == NULL);
pci_unmap_single(tp->pdev,
pci_unmap_addr(ri, mapping),
skb_headlen(skb),
@@ -2926,12 +2923,10 @@ static void tg3_tx(struct tg3 *tp)
sw_idx = NEXT_TX(sw_idx);
for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
- if (unlikely(sw_idx == hw_idx))
- BUG();
+ BUG_ON(sw_idx == hw_idx);
ri = &tp->tx_buffers[sw_idx];
- if (unlikely(ri->skb != NULL))
- BUG();
+ BUG_ON(ri->skb != NULL);
pci_unmap_page(tp->pdev,
pci_unmap_addr(ri, mapping),
@@ -4715,9 +4710,8 @@ static int tg3_halt_cpu(struct tg3 *tp,
{
int i;
- if (offset == TX_CPU_BASE &&
- (tp->tg3_flags2 & TG3_FLG2_5705_PLUS))
- BUG();
+ BUG_ON(offset == TX_CPU_BASE &&
+ (tp->tg3_flags2 & TG3_FLG2_5705_PLUS));
if (offset == RX_CPU_BASE) {
for (i = 0; i < 10000; i++) {
--- linux-2.6.16-rc2-git2/drivers/net/eql.c.orig 2006-02-07 21:43:10.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/eql.c 2006-02-07 21:43:24.000000000 +0100
@@ -203,8 +203,7 @@ static int eql_open(struct net_device *d
printk(KERN_INFO "%s: remember to turn off Van-Jacobson compression on "
"your slave devices.\n", dev->name);
- if (!list_empty(&eql->queue.all_slaves))
- BUG();
+ BUG_ON(!list_empty(&eql->queue.all_slaves));
eql->min_slaves = 1;
eql->max_slaves = EQL_DEFAULT_MAX_SLAVES; /* 4 usually... */
--- linux-2.6.16-rc2-git2/drivers/net/yellowfin.c.orig 2006-02-07 21:43:33.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/yellowfin.c 2006-02-07 21:43:42.000000000 +0100
@@ -1441,8 +1441,7 @@ static void __devexit yellowfin_remove_o
struct net_device *dev = pci_get_drvdata(pdev);
struct yellowfin_private *np;
- if (!dev)
- BUG();
+ BUG_ON(!dev);
np = netdev_priv(dev);
pci_free_consistent(pdev, STATUS_TOTAL_SIZE, np->tx_status,
--- linux-2.6.16-rc2-git2/drivers/net/ne2k-pci.c.orig 2006-02-07 21:43:55.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/ne2k-pci.c 2006-02-07 21:44:05.000000000 +0100
@@ -645,9 +645,7 @@ static void __devexit ne2k_pci_remove_on
{
struct net_device *dev = pci_get_drvdata(pdev);
- if (!dev)
- BUG();
-
+ BUG_ON(!dev);
unregister_netdev(dev);
release_region(dev->base_addr, NE_IO_EXTENT);
free_netdev(dev);
--- linux-2.6.16-rc2-git2/drivers/net/irda/sa1100_ir.c.orig 2006-02-07 21:45:11.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/irda/sa1100_ir.c 2006-02-07 21:45:21.000000000 +0100
@@ -695,8 +695,7 @@ static int sa1100_irda_hard_xmit(struct
/*
* We must not be transmitting...
*/
- if (si->txskb)
- BUG();
+ BUG_ON(si->txskb);
netif_stop_queue(dev);
--- linux-2.6.16-rc2-git2/drivers/net/chelsio/sge.c.orig 2006-02-07 21:45:33.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/chelsio/sge.c 2006-02-07 21:45:47.000000000 +0100
@@ -1093,8 +1093,7 @@ static int process_responses(struct adap
if (likely(e->DataValid)) {
struct freelQ *fl = &sge->freelQ[e->FreelistQid];
- if (unlikely(!e->Sop || !e->Eop))
- BUG();
+ BUG_ON(!e->Sop || !e->Eop);
if (unlikely(e->Offload))
unexpected_offload(adapter, fl);
else
--- linux-2.6.16-rc2-git2/drivers/net/b44.c.orig 2006-02-07 21:46:01.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/b44.c 2006-02-07 21:46:11.000000000 +0100
@@ -608,8 +608,7 @@ static void b44_tx(struct b44 *bp)
struct ring_info *rp = &bp->tx_buffers[cons];
struct sk_buff *skb = rp->skb;
- if (unlikely(skb == NULL))
- BUG();
+ BUG_ON(skb == NULL);
pci_unmap_single(bp->pdev,
pci_unmap_addr(rp, mapping),
--- linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c.orig 2006-02-07 21:47:52.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c 2006-02-07 21:48:23.000000000 +0100
@@ -761,8 +761,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
BUGMSG(D_DURING, "in arcnet_interrupt\n");
lp = dev->priv;
- if (!lp)
- BUG();
+ BUG_ON(!lp);
spin_lock(&lp->lock);
--- linux-2.6.16-rc2-git2/drivers/net/tokenring/madgemc.c.orig 2006-02-07 21:46:41.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/tokenring/madgemc.c 2006-02-07 21:47:29.000000000 +0100
@@ -735,8 +735,7 @@ static int __devexit madgemc_remove(stru
struct net_local *tp;
struct card_info *card;
- if (!dev)
- BUG();
+ BUG_ON(!dev);
tp = dev->priv;
card = tp->tmspriv;
--- linux-2.6.16-rc2-git2/drivers/net/tokenring/abyss.c.orig 2006-02-07 21:47:36.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/tokenring/abyss.c 2006-02-07 21:47:43.000000000 +0100
@@ -438,8 +438,7 @@ static void __devexit abyss_detach (stru
{
struct net_device *dev = pci_get_drvdata(pdev);
- if (!dev)
- BUG();
+ BUG_ON(!dev);
unregister_netdev(dev);
release_region(dev->base_addr-0x10, ABYSS_IO_EXTENT);
free_irq(dev->irq, dev);
--- linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c.orig 2006-02-07 21:47:52.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/arcnet/arcnet.c 2006-02-07 21:48:23.000000000 +0100
@@ -761,8 +761,7 @@ irqreturn_t arcnet_interrupt(int irq, vo
BUGMSG(D_DURING, "in arcnet_interrupt\n");
lp = dev->priv;
- if (!lp)
- BUG();
+ BUG_ON(!lp);
spin_lock(&lp->lock);
--- linux-2.6.16-rc2-git2/drivers/net/ns83820.c.orig 2006-02-07 21:49:57.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/ns83820.c 2006-02-07 21:51:04.000000000 +0100
@@ -567,8 +567,7 @@ static inline int ns83820_add_rx_skb(str
#endif
sg = dev->rx_info.descs + (next_empty * DESC_SIZE);
- if (unlikely(NULL != dev->rx_info.skbs[next_empty]))
- BUG();
+ BUG_ON(NULL != dev->rx_info.skbs[next_empty]);
dev->rx_info.skbs[next_empty] = skb;
dev->rx_info.next_empty = (next_empty + 1) % NR_RX_DESC;
--- linux-2.6.16-rc2-git2/drivers/net/wireless/ipw2200.c.orig 2006-02-07 21:51:20.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/wireless/ipw2200.c 2006-02-07 21:51:57.000000000 +0100
@@ -5603,8 +5603,7 @@ static void ipw_adhoc_create(struct ipw_
case IEEE80211_52GHZ_BAND:
network->mode = IEEE_A;
i = ipw_channel_to_index(priv->ieee, priv->channel);
- if (i == -1)
- BUG();
+ BUG_ON(i == -1);
if (geo->a[i].flags & IEEE80211_CH_PASSIVE_ONLY) {
IPW_WARNING("Overriding invalid channel\n");
priv->channel = geo->a[0].channel;
@@ -5617,8 +5616,7 @@ static void ipw_adhoc_create(struct ipw_
else
network->mode = IEEE_B;
i = ipw_channel_to_index(priv->ieee, priv->channel);
- if (i == -1)
- BUG();
+ BUG_ON(i == -1);
if (geo->bg[i].flags & IEEE80211_CH_PASSIVE_ONLY) {
IPW_WARNING("Overriding invalid channel\n");
priv->channel = geo->bg[0].channel;
@@ -6756,8 +6754,7 @@ static int ipw_qos_association(struct ip
switch (priv->ieee->iw_mode) {
case IW_MODE_ADHOC:
- if (!(network->capability & WLAN_CAPABILITY_IBSS))
- BUG();
+ BUG_ON(!(network->capability & WLAN_CAPABILITY_IBSS));
qos_data = &ibss_data;
break;
--- linux-2.6.16-rc2-git2/drivers/net/8139cp.c.orig 2006-02-07 21:52:12.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/8139cp.c 2006-02-07 21:52:49.000000000 +0100
@@ -539,8 +539,7 @@ rx_status_loop:
unsigned buflen;
skb = cp->rx_skb[rx_tail].skb;
- if (!skb)
- BUG();
+ BUG_ON(!skb);
desc = &cp->rx_ring[rx_tail];
status = le32_to_cpu(desc->opts1);
@@ -723,8 +722,7 @@ static void cp_tx (struct cp_private *cp
break;
skb = cp->tx_skb[tx_tail].skb;
- if (!skb)
- BUG();
+ BUG_ON(!skb);
pci_unmap_single(cp->pdev, cp->tx_skb[tx_tail].mapping,
cp->tx_skb[tx_tail].len, PCI_DMA_TODEVICE);
@@ -1545,8 +1543,7 @@ static void cp_get_ethtool_stats (struct
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_abort);
tmp_stats[i++] = le16_to_cpu(nic_stats->tx_underrun);
tmp_stats[i++] = cp->cp_stats.rx_frags;
- if (i != CP_NUM_STATS)
- BUG();
+ BUG_ON(i != CP_NUM_STATS);
pci_free_consistent(cp->pdev, sizeof(*nic_stats), nic_stats, dma);
}
@@ -1851,8 +1848,7 @@ static void cp_remove_one (struct pci_de
struct net_device *dev = pci_get_drvdata(pdev);
struct cp_private *cp = netdev_priv(dev);
- if (!dev)
- BUG();
+ BUG_ON(!dev);
unregister_netdev(dev);
iounmap(cp->regs);
if (cp->wol_enabled) pci_set_power_state (pdev, PCI_D0);
--- linux-2.6.16-rc2-git2/drivers/net/starfire.c.orig 2006-02-07 21:52:59.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/net/starfire.c 2006-02-07 21:53:34.000000000 +0100
@@ -2090,8 +2090,7 @@ static void __devexit starfire_remove_on
struct net_device *dev = pci_get_drvdata(pdev);
struct netdev_private *np = netdev_priv(dev);
- if (!dev)
- BUG();
+ BUG_ON(!dev);
unregister_netdev(dev);
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/scsi
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (7 preceding siblings ...)
2006-02-08 11:07 ` Eric Sesterhenn
@ 2006-02-09 17:25 ` Eric Sesterhenn
2006-02-09 17:29 ` [KJ] [Patch] BUG_ON() Conversion in drivers/char Eric Sesterhenn
` (3 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn @ 2006-02-09 17:25 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 5926 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc2-git2/drivers/scsi/arm/queue.c.orig 2006-02-08 18:12:18.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/arm/queue.c 2006-02-08 18:12:48.000000000 +0100
@@ -118,8 +118,7 @@ int __queue_add(Queue_t *queue, Scsi_Cmn
list_del(l);
q = list_entry(l, QE_t, list);
- if (BAD_MAGIC(q, QUEUE_MAGIC_FREE))
- BUG();
+ BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_FREE));
SET_MAGIC(q, QUEUE_MAGIC_USED);
q->SCpnt = SCpnt;
@@ -144,8 +143,7 @@ static Scsi_Cmnd *__queue_remove(Queue_t
*/
list_del(ent);
q = list_entry(ent, QE_t, list);
- if (BAD_MAGIC(q, QUEUE_MAGIC_USED))
- BUG();
+ BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_USED));
SET_MAGIC(q, QUEUE_MAGIC_FREE);
list_add(ent, &queue->free);
--- linux-2.6.16-rc2-git2/drivers/scsi/ibmmca.c.orig 2006-02-08 18:13:01.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/ibmmca.c 2006-02-08 18:13:10.000000000 +0100
@@ -2243,8 +2243,7 @@ static int __ibmmca_host_reset(Scsi_Cmnd
int host_index;
unsigned long imm_command;
- if (cmd == NULL)
- BUG();
+ BUG_ON(cmd == NULL);
ticks = IM_RESET_DELAY * HZ;
shpnt = cmd->device->host;
--- linux-2.6.16-rc2-git2/drivers/scsi/aacraid/aachba.c.orig 2006-02-08 18:13:23.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/aacraid/aachba.c 2006-02-08 18:14:28.000000000 +0100
@@ -388,8 +388,7 @@ static void get_container_name_callback(
scsicmd = (struct scsi_cmnd *) context;
dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies));
- if (fibptr == NULL)
- BUG();
+ BUG_ON(fibptr == NULL);
get_name_reply = (struct aac_get_name_resp *) fib_data(fibptr);
/* Failure is irrelevant, using default value instead */
@@ -945,8 +944,7 @@ static void io_callback(void *context, s
smp_processor_id(), (unsigned long long)lba, jiffies);
}
- if (fibptr == NULL)
- BUG();
+ BUG_ON(fibptr == NULL);
if(scsicmd->use_sg)
pci_unmap_sg(dev->pdev,
@@ -1081,8 +1079,7 @@ static int aac_read(struct scsi_cmnd * s
aac_build_sgraw(scsicmd, &readcmd->sg);
fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw));
- if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))
- BUG();
+ BUG_ON(fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
@@ -1248,8 +1245,7 @@ static int aac_write(struct scsi_cmnd *
aac_build_sgraw(scsicmd, &writecmd->sg);
fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(writecmd->sg.count) - 1) * sizeof (struct sgentryraw));
- if (fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)))
- BUG();
+ BUG_ON(fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)));
/*
* Now send the Fib to the adapter
*/
@@ -1891,8 +1887,7 @@ static void aac_srb_callback(void *conte
scsicmd = (struct scsi_cmnd *) context;
dev = (struct aac_dev *)scsicmd->device->host->hostdata;
- if (fibptr == NULL)
- BUG();
+ BUG_ON(fibptr == NULL);
srbreply = (struct aac_srb_reply *) fib_data(fibptr);
--- linux-2.6.16-rc2-git2/drivers/scsi/aacraid/commsup.c.orig 2006-02-08 18:14:41.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/aacraid/commsup.c 2006-02-08 18:15:25.000000000 +0100
@@ -228,9 +228,8 @@ void fib_init(struct fib *fibptr)
static void fib_dealloc(struct fib * fibptr)
{
struct hw_fib *hw_fib = fibptr->hw_fib;
- if(hw_fib->header.StructType != FIB_MAGIC)
- BUG();
- hw_fib->header.XferState = 0;
+ BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
+ hw_fib->header.XferState = 0;
}
/*
@@ -531,9 +530,8 @@ int fib_send(u16 command, struct fib * f
}
} else
down(&fibptr->event_wait);
- if(fibptr->done == 0)
- BUG();
-
+ BUG_ON(fibptr->done == 0);
+
if((fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)){
return -ETIMEDOUT;
} else {
--- linux-2.6.16-rc2-git2/drivers/scsi/53c700.h.orig 2006-02-08 18:16:11.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/53c700.h 2006-02-08 18:16:27.000000000 +0100
@@ -472,8 +472,7 @@ NCR_700_readl(struct Scsi_Host *host, __
ioread32(hostdata->base + reg);
#if 1
/* sanity check the register */
- if((reg & 0x3) != 0)
- BUG();
+ BUG_ON((reg & 0x3) != 0);
#endif
return value;
@@ -496,8 +495,7 @@ NCR_700_writel(__u32 value, struct Scsi_
#if 1
/* sanity check the register */
- if((reg & 0x3) != 0)
- BUG();
+ BUG_ON((reg & 0x3) != 0);
#endif
bEBus ? iowrite32be(value, hostdata->base + reg):
--- linux-2.6.16-rc2-git2/drivers/scsi/megaraid.c.orig 2006-02-08 18:16:38.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/megaraid.c 2006-02-08 18:16:51.000000000 +0100
@@ -1827,7 +1827,7 @@ mega_build_sglist(adapter_t *adapter, sc
scb->dma_type = MEGA_SGLIST;
- if( sgcnt > adapter->sglen ) BUG();
+ BUG_ON( sgcnt > adapter->sglen );
*len = 0;
--- linux-2.6.16-rc2-git2/drivers/scsi/ide-scsi.c.orig 2006-02-08 18:17:01.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/scsi/ide-scsi.c 2006-02-08 18:17:21.000000000 +0100
@@ -599,8 +599,7 @@ static ide_startstop_t idescsi_transfer_
"issuing a packet command\n");
return ide_do_reset (drive);
}
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
/* Set the interrupt routine */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
/* Send the actual packet */
@@ -690,8 +689,7 @@ static ide_startstop_t idescsi_issue_pc
set_bit(PC_DMA_OK, &pc->flags);
if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
- if (HWGROUP(drive)->handler != NULL)
- BUG();
+ BUG_ON(HWGROUP(drive)->handler != NULL);
ide_set_handler(drive, &idescsi_transfer_pc,
get_timeout(pc), idescsi_expiry);
/* Issue the packet command */
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/char
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (8 preceding siblings ...)
2006-02-09 17:25 ` [KJ] [Patch] BUG_ON() Conversion in drivers/scsi Eric Sesterhenn
@ 2006-02-09 17:29 ` Eric Sesterhenn
2006-02-10 15:23 ` [KJ] [Patch] BUG_ON() Conversion in drivers/isdn Eric Sesterhenn
` (2 subsequent siblings)
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn @ 2006-02-09 17:29 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1544 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc2-git2/drivers/char/tty_io.c.orig 2006-02-09 18:26:37.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/char/tty_io.c 2006-02-09 18:27:20.000000000 +0100
@@ -538,14 +538,12 @@ void tty_ldisc_put(int disc)
struct tty_ldisc *ld;
unsigned long flags;
- if (disc < N_TTY || disc >= NR_LDISCS)
- BUG();
+ BUG_ON(disc < N_TTY || disc >= NR_LDISCS);
spin_lock_irqsave(&tty_ldisc_lock, flags);
ld = &tty_ldiscs[disc];
- if(ld->refcount == 0)
- BUG();
- ld->refcount --;
+ BUG_ON(ld->refcount == 0);
+ ld->refcount--;
module_put(ld->owner);
spin_unlock_irqrestore(&tty_ldisc_lock, flags);
}
@@ -640,8 +638,7 @@ void tty_ldisc_deref(struct tty_ldisc *l
{
unsigned long flags;
- if(ld == NULL)
- BUG();
+ BUG_ON(ld == NULL);
spin_lock_irqsave(&tty_ldisc_lock, flags);
if(ld->refcount == 0)
--- linux-2.6.16-rc2-git2/drivers/char/epca.c.orig 2006-02-09 18:27:31.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/char/epca.c 2006-02-09 18:27:48.000000000 +0100
@@ -486,8 +486,7 @@ static void pc_close(struct tty_struct *
} /* End channel is open more than once */
/* Port open only once go ahead with shutdown & reset */
- if (ch->count < 0)
- BUG();
+ BUG_ON(ch->count < 0);
/* ---------------------------------------------------------------
Let the rest of the driver know the channel is being closed.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* [KJ] [Patch] BUG_ON() Conversion in drivers/isdn
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (9 preceding siblings ...)
2006-02-09 17:29 ` [KJ] [Patch] BUG_ON() Conversion in drivers/char Eric Sesterhenn
@ 2006-02-10 15:23 ` Eric Sesterhenn
2006-02-20 19:53 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Alexey Dobriyan
2006-02-20 21:48 ` [KJ] [Patch] BUG_ON() Conversion in drivers/scsi Alexey Dobriyan
12 siblings, 0 replies; 14+ messages in thread
From: Eric Sesterhenn @ 2006-02-10 15:23 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 3407 bytes --]
hi,
this changes if() BUG(); constructs to BUG_ON() which is
cleaner, contains unlikely() and can better optimized away.
Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
--- linux-2.6.16-rc2-git2/drivers/isdn/hisax/hisax_isac.c.orig 2006-02-09 19:56:34.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/isdn/hisax/hisax_isac.c 2006-02-09 19:57:02.000000000 +0100
@@ -476,12 +476,10 @@ static void isac_fill_fifo(struct isac *
unsigned char cmd;
u_char *ptr;
- if (!isac->tx_skb)
- BUG();
+ BUG_ON(!isac->tx_skb);
count = isac->tx_skb->len;
- if (count <= 0)
- BUG();
+ BUG_ON(count <= 0);
DBG(DBG_IRQ, "count %d", count);
@@ -859,8 +857,7 @@ void isac_d_l2l1(struct hisax_if *hisax_
dev_kfree_skb(skb);
break;
}
- if (isac->tx_skb)
- BUG();
+ BUG_ON(isac->tx_skb);
isac->tx_skb = skb;
isac_fill_fifo(isac);
--- linux-2.6.16-rc2-git2/drivers/isdn/hisax/st5481_b.c.orig 2006-02-09 19:57:17.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/isdn/hisax/st5481_b.c 2006-02-09 19:57:30.000000000 +0100
@@ -356,9 +356,7 @@ void st5481_b_l2l1(struct hisax_if *ifc,
switch (pr) {
case PH_DATA | REQUEST:
- if (bcs->b_out.tx_skb)
- BUG();
-
+ BUG_ON(bcs->b_out.tx_skb);
bcs->b_out.tx_skb = skb;
break;
case PH_ACTIVATE | REQUEST:
--- linux-2.6.16-rc2-git2/drivers/isdn/hisax/hisax_fcpcipnp.c.orig 2006-02-09 19:57:44.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/isdn/hisax/hisax_fcpcipnp.c 2006-02-09 19:58:00.000000000 +0100
@@ -387,8 +387,7 @@ static void hdlc_fill_fifo(struct fritz_
DBG(0x40, "hdlc_fill_fifo");
- if (skb->len == 0)
- BUG();
+ BUG_ON(skb->len == 0);
bcs->ctrl.sr.cmd &= ~HDLC_CMD_XME;
if (bcs->tx_skb->len > bcs->fifo_size) {
@@ -630,9 +629,7 @@ static void fritz_b_l2l1(struct hisax_if
switch (pr) {
case PH_DATA | REQUEST:
- if (bcs->tx_skb)
- BUG();
-
+ BUG_ON(bcs->tx_skb);
bcs->tx_skb = skb;
DBG_SKB(1, skb);
hdlc_fill_fifo(bcs);
--- linux-2.6.16-rc2-git2/drivers/isdn/hisax/st5481_d.c.orig 2006-02-09 19:58:19.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/isdn/hisax/st5481_d.c 2006-02-09 19:58:31.000000000 +0100
@@ -596,9 +596,7 @@ void st5481_d_l2l1(struct hisax_if *hisa
break;
case PH_DATA | REQUEST:
DBG(2, "PH_DATA REQUEST len %d", skb->len);
- if (adapter->d_out.tx_skb)
- BUG();
-
+ BUG_ON(adapter->d_out.tx_skb);
adapter->d_out.tx_skb = skb;
FsmEvent(&adapter->d_out.fsm, EV_DOUT_START_XMIT, NULL);
break;
--- linux-2.6.16-rc2-git2/drivers/isdn/i4l/isdn_ppp.c.orig 2006-02-09 19:58:58.000000000 +0100
+++ linux-2.6.16-rc2-git2/drivers/isdn/i4l/isdn_ppp.c 2006-02-09 19:59:31.000000000 +0100
@@ -973,8 +973,7 @@ void isdn_ppp_receive(isdn_net_dev * net
int slot;
int proto;
- if (net_dev->local->master)
- BUG(); // we're called with the master device always
+ BUG_ON(net_dev->local->master); // we're called with the master device always
slot = lp->ppp_slot;
if (slot < 0 || slot >= ISDN_MAX_CHANNELS) {
@@ -2526,8 +2525,7 @@ static struct sk_buff *isdn_ppp_decompre
printk(KERN_DEBUG "ippp: no decompressor defined!\n");
return skb;
}
- if (!stat) // if we have a compressor, stat has been set as well
- BUG();
+ BUG_ON(!stat); // if we have a compressor, stat has been set as well
if((master && *proto == PPP_COMP) || (!master && *proto == PPP_COMPFRAG) ) {
// compressed packets are compressed by their protocol type
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [KJ] [Patch] BUG_ON() Conversion in drivers/net/
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (10 preceding siblings ...)
2006-02-10 15:23 ` [KJ] [Patch] BUG_ON() Conversion in drivers/isdn Eric Sesterhenn
@ 2006-02-20 19:53 ` Alexey Dobriyan
2006-02-20 21:48 ` [KJ] [Patch] BUG_ON() Conversion in drivers/scsi Alexey Dobriyan
12 siblings, 0 replies; 14+ messages in thread
From: Alexey Dobriyan @ 2006-02-20 19:53 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 98 bytes --]
Applied. Some of these BUG()s can be removed because there would an
Oops few lines below anyway.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
* Re: [KJ] [Patch] BUG_ON() Conversion in drivers/scsi
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
` (11 preceding siblings ...)
2006-02-20 19:53 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Alexey Dobriyan
@ 2006-02-20 21:48 ` Alexey Dobriyan
12 siblings, 0 replies; 14+ messages in thread
From: Alexey Dobriyan @ 2006-02-20 21:48 UTC (permalink / raw)
To: kernel-janitors
[-- Attachment #1: Type: text/plain, Size: 1645 bytes --]
On Thu, Feb 09, 2006 at 06:25:40PM +0100, Eric Sesterhenn wrote:
> this changes if() BUG(); constructs to BUG_ON() which is
> cleaner, contains unlikely() and can better optimized away.
Applied.
> --- linux-2.6.16-rc2-git2/drivers/scsi/ibmmca.c.orig
> +++ linux-2.6.16-rc2-git2/drivers/scsi/ibmmca.c
> @@ -2243,8 +2243,7 @@ static int __ibmmca_host_reset(Scsi_Cmnd
> int host_index;
> unsigned long imm_command;
>
> - if (cmd == NULL)
> - BUG();
> + BUG_ON(cmd == NULL);
>
> ticks = IM_RESET_DELAY * HZ;
> shpnt = cmd->device->host;
This one can be removed.
> --- linux-2.6.16-rc2-git2/drivers/scsi/aacraid/aachba.c.orig
> +++ linux-2.6.16-rc2-git2/drivers/scsi/aacraid/aachba.c
> @@ -388,8 +388,7 @@ static void get_container_name_callback(
> scsicmd = (struct scsi_cmnd *) context;
>
> dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies));
> - if (fibptr == NULL)
> - BUG();
> + BUG_ON(fibptr == NULL);
>
> get_name_reply = (struct aac_get_name_resp *) fib_data(fibptr);
> @@ -945,8 +944,7 @@ static void io_callback(void *context, s
> smp_processor_id(), (unsigned long long)lba, jiffies);
> }
>
> - if (fibptr == NULL)
> - BUG();
> + BUG_ON(fibptr == NULL);
>
> if(scsicmd->use_sg)
> pci_unmap_sg(dev->pdev,
> @@ -1891,8 +1887,7 @@ static void aac_srb_callback(void *conte
> scsicmd = (struct scsi_cmnd *) context;
> dev = (struct aac_dev *)scsicmd->device->host->hostdata;
>
> - if (fibptr == NULL)
> - BUG();
> + BUG_ON(fibptr == NULL);
>
> srbreply = (struct aac_srb_reply *) fib_data(fibptr);
Almost certainly these too. Haven't checked deeply.
[-- Attachment #2: Type: text/plain, Size: 168 bytes --]
_______________________________________________
Kernel-janitors mailing list
Kernel-janitors@lists.osdl.org
https://lists.osdl.org/mailman/listinfo/kernel-janitors
^ permalink raw reply [flat|nested] 14+ messages in thread
end of thread, other threads:[~2006-02-20 21:48 UTC | newest]
Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-01 0:27 [KJ] [Patch] BUG_ON() Conversion in drivers/block/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/ide/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/media/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/parisc/ Eric Sesterhenn / snakebyte
2006-02-01 0:28 ` [KJ] [Patch] BUG_ON() Conversion in drivers/video/ Eric Sesterhenn / snakebyte
2006-02-07 21:52 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Eric Sesterhenn
2006-02-07 22:02 ` [KJ] [Patch] BUG_ON() Conversion in drivers/mtd/ Eric Sesterhenn
2006-02-07 23:24 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Håkon Løvdal
2006-02-08 11:07 ` Eric Sesterhenn
2006-02-09 17:25 ` [KJ] [Patch] BUG_ON() Conversion in drivers/scsi Eric Sesterhenn
2006-02-09 17:29 ` [KJ] [Patch] BUG_ON() Conversion in drivers/char Eric Sesterhenn
2006-02-10 15:23 ` [KJ] [Patch] BUG_ON() Conversion in drivers/isdn Eric Sesterhenn
2006-02-20 19:53 ` [KJ] [Patch] BUG_ON() Conversion in drivers/net/ Alexey Dobriyan
2006-02-20 21:48 ` [KJ] [Patch] BUG_ON() Conversion in drivers/scsi Alexey Dobriyan
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).