[PATCH] More BUG_ON conversion

Signed-off-by: Eric Sesterhenn <snakebyte@gmx.de>
Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Bartlomiej Zolnierkiewicz <B.Zolnierkiewicz@elka.pw.edu.pl>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: James Bottomley <James.Bottomley@steeleye.com>
Acked-by: "Salyzyn, Mark" <mark_salyzyn@adaptec.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
This commit is contained in:
Eric Sesterhenn 2006-06-23 02:06:06 -07:00 committed by Linus Torvalds
parent 78ce89c92b
commit 125e18745f
18 changed files with 34 additions and 65 deletions

View file

@ -814,7 +814,7 @@ void __init setup_arch(char **cmdline_p)
* - by now the stack is part of the init task */ * - by now the stack is part of the init task */
printk("Memory %08lx-%08lx\n", memory_start, memory_end); printk("Memory %08lx-%08lx\n", memory_start, memory_end);
if (memory_start == memory_end) BUG(); BUG_ON(memory_start == memory_end);
init_mm.start_code = (unsigned long) &_stext; init_mm.start_code = (unsigned long) &_stext;
init_mm.end_code = (unsigned long) &_etext; init_mm.end_code = (unsigned long) &_etext;

View file

@ -1725,8 +1725,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
} }
} }
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, NULL); ide_set_handler(drive, cdrom_newpc_intr, rq->timeout, NULL);
return ide_started; return ide_started;

View file

@ -206,8 +206,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct scatterlist *sg = hwif->sg_table; struct scatterlist *sg = hwif->sg_table;
if ((rq->flags & REQ_DRIVE_TASKFILE) && rq->nr_sectors > 256) BUG_ON((rq->flags & REQ_DRIVE_TASKFILE) && rq->nr_sectors > 256);
BUG();
ide_map_sg(drive, rq); ide_map_sg(drive, rq);
@ -947,8 +946,7 @@ void ide_setup_dma (ide_hwif_t *hwif, unsigned long dma_base, unsigned int num_p
} }
printk("\n"); printk("\n");
if (!(hwif->dma_master)) BUG_ON(!hwif->dma_master);
BUG();
} }
EXPORT_SYMBOL_GPL(ide_setup_dma); EXPORT_SYMBOL_GPL(ide_setup_dma);

View file

@ -898,8 +898,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
"to send us more data than expected " "to send us more data than expected "
"- discarding data\n"); "- discarding data\n");
idefloppy_discard_data(drive,bcount.all); idefloppy_discard_data(drive,bcount.all);
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, ide_set_handler(drive,
&idefloppy_pc_intr, &idefloppy_pc_intr,
IDEFLOPPY_WAIT_CMD, IDEFLOPPY_WAIT_CMD,
@ -932,8 +931,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
pc->actually_transferred += bcount.all; pc->actually_transferred += bcount.all;
pc->current_position += bcount.all; pc->current_position += bcount.all;
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */ ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); /* And set the interrupt handler again */
return ide_started; return ide_started;
} }
@ -960,8 +958,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
"issuing a packet command\n"); "issuing a packet command\n");
return ide_do_reset(drive); return ide_do_reset(drive);
} }
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
/* Set the interrupt routine */ /* Set the interrupt routine */
ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL); ide_set_handler(drive, &idefloppy_pc_intr, IDEFLOPPY_WAIT_CMD, NULL);
/* Send the actual packet */ /* Send the actual packet */
@ -1017,8 +1014,7 @@ static ide_startstop_t idefloppy_transfer_pc1 (ide_drive_t *drive)
* 40 and 50msec work well. idefloppy_pc_intr will not be actually * 40 and 50msec work well. idefloppy_pc_intr will not be actually
* used until after the packet is moved in about 50 msec. * used until after the packet is moved in about 50 msec.
*/ */
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, ide_set_handler(drive,
&idefloppy_pc_intr, /* service routine for packet command */ &idefloppy_pc_intr, /* service routine for packet command */
floppy->ticks, /* wait this long before "failing" */ floppy->ticks, /* wait this long before "failing" */

View file

@ -939,8 +939,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if(hwgroup->handler) BUG_ON(hwgroup->handler);
BUG();
hwgroup->handler = handler; hwgroup->handler = handler;
hwgroup->expiry = expiry; hwgroup->expiry = expiry;
hwgroup->timer.expires = jiffies + timeout; hwgroup->timer.expires = jiffies + timeout;
@ -981,8 +980,7 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
printk("%s: ATAPI reset complete\n", drive->name); printk("%s: ATAPI reset complete\n", drive->name);
} else { } else {
if (time_before(jiffies, hwgroup->poll_timeout)) { if (time_before(jiffies, hwgroup->poll_timeout)) {
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL); ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
/* continue polling */ /* continue polling */
return ide_started; return ide_started;
@ -1021,8 +1019,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
if (!OK_STAT(tmp = hwif->INB(IDE_STATUS_REG), 0, BUSY_STAT)) { if (!OK_STAT(tmp = hwif->INB(IDE_STATUS_REG), 0, BUSY_STAT)) {
if (time_before(jiffies, hwgroup->poll_timeout)) { if (time_before(jiffies, hwgroup->poll_timeout)) {
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL);
/* continue polling */ /* continue polling */
return ide_started; return ide_started;
@ -1138,8 +1135,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
hwgroup = HWGROUP(drive); hwgroup = HWGROUP(drive);
/* We must not reset with running handlers */ /* We must not reset with running handlers */
if(hwgroup->handler != NULL) BUG_ON(hwgroup->handler != NULL);
BUG();
/* For an ATAPI device, first try an ATAPI SRST. */ /* For an ATAPI device, first try an ATAPI SRST. */
if (drive->media != ide_disk && !do_not_try_atapi) { if (drive->media != ide_disk && !do_not_try_atapi) {

View file

@ -164,8 +164,7 @@ u8 ide_rate_filter (u8 mode, u8 speed)
// printk("%s: mode 0x%02x, speed 0x%02x\n", __FUNCTION__, mode, speed); // printk("%s: mode 0x%02x, speed 0x%02x\n", __FUNCTION__, mode, speed);
/* So that we remember to update this if new modes appear */ /* So that we remember to update this if new modes appear */
if (mode > 4) BUG_ON(mode > 4);
BUG();
return min(speed, speed_max[mode]); return min(speed, speed_max[mode]);
#else /* !CONFIG_BLK_DEV_IDEDMA */ #else /* !CONFIG_BLK_DEV_IDEDMA */
return min(speed, (u8)XFER_PIO_4); return min(speed, (u8)XFER_PIO_4);

View file

@ -196,8 +196,7 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive)
if (stat & (ERR_STAT|DRQ_STAT)) if (stat & (ERR_STAT|DRQ_STAT))
return ide_error(drive, "set_geometry_intr", stat); return ide_error(drive, "set_geometry_intr", stat);
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, &set_geometry_intr, WAIT_WORSTCASE, NULL); ide_set_handler(drive, &set_geometry_intr, WAIT_WORSTCASE, NULL);
return ide_started; return ide_started;
} }

View file

@ -1367,8 +1367,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
ide_abort(drive, "drive reset"); ide_abort(drive, "drive reset");
if(HWGROUP(drive)->handler) BUG_ON(HWGROUP(drive)->handler);
BUG();
/* Ensure nothing gets queued after we /* Ensure nothing gets queued after we
drop the lock. Reset will clear the busy */ drop the lock. Reset will clear the busy */

View file

@ -183,8 +183,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
{ {
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
if (HWGROUP(drive)->handler != NULL) /* paranoia check */ BUG_ON(HWGROUP(drive)->handler != NULL); /* paranoia check */
BUG();
ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL); ide_set_handler(drive, &ide_dma_intr, WAIT_CMD, NULL);
/* issue cmd to drive */ /* issue cmd to drive */
hwif->OUTB(command, IDE_COMMAND_REG); hwif->OUTB(command, IDE_COMMAND_REG);

View file

@ -474,8 +474,7 @@ NCR_700_readl(struct Scsi_Host *host, __u32 reg)
ioread32(hostdata->base + reg); ioread32(hostdata->base + reg);
#if 1 #if 1
/* sanity check the register */ /* sanity check the register */
if((reg & 0x3) != 0) BUG_ON((reg & 0x3) != 0);
BUG();
#endif #endif
return value; return value;
@ -498,8 +497,7 @@ NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg)
#if 1 #if 1
/* sanity check the register */ /* sanity check the register */
if((reg & 0x3) != 0) BUG_ON((reg & 0x3) != 0);
BUG();
#endif #endif
bEBus ? iowrite32be(value, hostdata->base + reg): bEBus ? iowrite32be(value, hostdata->base + reg):

View file

@ -396,8 +396,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies)); dprintk((KERN_DEBUG "get_container_name_callback[cpu %d]: t = %ld.\n", smp_processor_id(), jiffies));
if (fibptr == NULL) BUG_ON(fibptr == NULL);
BUG();
get_name_reply = (struct aac_get_name_resp *) fib_data(fibptr); get_name_reply = (struct aac_get_name_resp *) fib_data(fibptr);
/* Failure is irrelevant, using default value instead */ /* Failure is irrelevant, using default value instead */
@ -956,8 +955,7 @@ static void io_callback(void *context, struct fib * fibptr)
smp_processor_id(), (unsigned long long)lba, jiffies); smp_processor_id(), (unsigned long long)lba, jiffies);
} }
if (fibptr == NULL) BUG_ON(fibptr == NULL);
BUG();
if(scsicmd->use_sg) if(scsicmd->use_sg)
pci_unmap_sg(dev->pdev, pci_unmap_sg(dev->pdev,
@ -1092,8 +1090,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
aac_build_sgraw(scsicmd, &readcmd->sg); aac_build_sgraw(scsicmd, &readcmd->sg);
fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(readcmd->sg.count) - 1) * sizeof (struct sgentryraw)); 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_ON(fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)));
BUG();
/* /*
* Now send the Fib to the adapter * Now send the Fib to the adapter
*/ */
@ -1261,8 +1258,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
aac_build_sgraw(scsicmd, &writecmd->sg); aac_build_sgraw(scsicmd, &writecmd->sg);
fibsize = sizeof(struct aac_raw_io) + ((le32_to_cpu(writecmd->sg.count) - 1) * sizeof (struct sgentryraw)); 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_ON(fibsize > (dev->max_fib_size - sizeof(struct aac_fibhdr)));
BUG();
/* /*
* Now send the Fib to the adapter * Now send the Fib to the adapter
*/ */
@ -1904,8 +1900,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL; scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
dev = (struct aac_dev *)scsicmd->device->host->hostdata; dev = (struct aac_dev *)scsicmd->device->host->hostdata;
if (fibptr == NULL) BUG_ON(fibptr == NULL);
BUG();
srbreply = (struct aac_srb_reply *) fib_data(fibptr); srbreply = (struct aac_srb_reply *) fib_data(fibptr);

View file

@ -229,8 +229,7 @@ void aac_fib_init(struct fib *fibptr)
static void fib_dealloc(struct fib * fibptr) static void fib_dealloc(struct fib * fibptr)
{ {
struct hw_fib *hw_fib = fibptr->hw_fib; struct hw_fib *hw_fib = fibptr->hw_fib;
if(hw_fib->header.StructType != FIB_MAGIC) BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
BUG();
hw_fib->header.XferState = 0; hw_fib->header.XferState = 0;
} }
@ -530,8 +529,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
} }
} else } else
down(&fibptr->event_wait); down(&fibptr->event_wait);
if(fibptr->done == 0) BUG_ON(fibptr->done == 0);
BUG();
if((fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)){ if((fibptr->flags & FIB_CONTEXT_FLAG_TIMED_OUT)){
return -ETIMEDOUT; return -ETIMEDOUT;

View file

@ -118,8 +118,7 @@ int __queue_add(Queue_t *queue, Scsi_Cmnd *SCpnt, int head)
list_del(l); list_del(l);
q = list_entry(l, QE_t, list); q = list_entry(l, QE_t, list);
if (BAD_MAGIC(q, QUEUE_MAGIC_FREE)) BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_FREE));
BUG();
SET_MAGIC(q, QUEUE_MAGIC_USED); SET_MAGIC(q, QUEUE_MAGIC_USED);
q->SCpnt = SCpnt; q->SCpnt = SCpnt;
@ -144,8 +143,7 @@ static Scsi_Cmnd *__queue_remove(Queue_t *queue, struct list_head *ent)
*/ */
list_del(ent); list_del(ent);
q = list_entry(ent, QE_t, list); q = list_entry(ent, QE_t, list);
if (BAD_MAGIC(q, QUEUE_MAGIC_USED)) BUG_ON(BAD_MAGIC(q, QUEUE_MAGIC_USED));
BUG();
SET_MAGIC(q, QUEUE_MAGIC_FREE); SET_MAGIC(q, QUEUE_MAGIC_FREE);
list_add(ent, &queue->free); list_add(ent, &queue->free);

View file

@ -2241,8 +2241,7 @@ static int __ibmmca_host_reset(Scsi_Cmnd * cmd)
int host_index; int host_index;
unsigned long imm_command; unsigned long imm_command;
if (cmd == NULL) BUG_ON(cmd == NULL);
BUG();
ticks = IM_RESET_DELAY * HZ; ticks = IM_RESET_DELAY * HZ;
shpnt = cmd->device->host; shpnt = cmd->device->host;

View file

@ -600,8 +600,7 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
"issuing a packet command\n"); "issuing a packet command\n");
return ide_do_reset (drive); return ide_do_reset (drive);
} }
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
/* Set the interrupt routine */ /* Set the interrupt routine */
ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry); ide_set_handler(drive, &idescsi_pc_intr, get_timeout(pc), idescsi_expiry);
/* Send the actual packet */ /* Send the actual packet */
@ -691,8 +690,7 @@ static ide_startstop_t idescsi_issue_pc (ide_drive_t *drive, idescsi_pc_t *pc)
set_bit(PC_DMA_OK, &pc->flags); set_bit(PC_DMA_OK, &pc->flags);
if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) { if (test_bit(IDESCSI_DRQ_INTERRUPT, &scsi->flags)) {
if (HWGROUP(drive)->handler != NULL) BUG_ON(HWGROUP(drive)->handler != NULL);
BUG();
ide_set_handler(drive, &idescsi_transfer_pc, ide_set_handler(drive, &idescsi_transfer_pc,
get_timeout(pc), idescsi_expiry); get_timeout(pc), idescsi_expiry);
/* Issue the packet command */ /* Issue the packet command */

View file

@ -1828,7 +1828,7 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
scb->dma_type = MEGA_SGLIST; scb->dma_type = MEGA_SGLIST;
if( sgcnt > adapter->sglen ) BUG(); BUG_ON(sgcnt > adapter->sglen);
*len = 0; *len = 0;

View file

@ -579,7 +579,7 @@ static void exit_mm(struct task_struct * tsk)
down_read(&mm->mmap_sem); down_read(&mm->mmap_sem);
} }
atomic_inc(&mm->mm_count); atomic_inc(&mm->mm_count);
if (mm != tsk->active_mm) BUG(); BUG_ON(mm != tsk->active_mm);
/* more a memory barrier than a real lock */ /* more a memory barrier than a real lock */
task_lock(tsk); task_lock(tsk);
tsk->mm = NULL; tsk->mm = NULL;
@ -1530,8 +1530,7 @@ check_continued:
if (options & __WNOTHREAD) if (options & __WNOTHREAD)
break; break;
tsk = next_thread(tsk); tsk = next_thread(tsk);
if (tsk->signal != current->signal) BUG_ON(tsk->signal != current->signal);
BUG();
} while (tsk != current); } while (tsk != current);
read_unlock(&tasklist_lock); read_unlock(&tasklist_lock);

View file

@ -202,8 +202,7 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0)
unsigned long flags; unsigned long flags;
int ret = 0; int ret = 0;
if (fn == NULL) BUG_ON(fn == NULL); /* Hard to diagnose if it's deferred */
BUG(); /* Hard to diagnose if it's deferred */
spin_lock_irqsave(&pdflush_lock, flags); spin_lock_irqsave(&pdflush_lock, flags);
if (list_empty(&pdflush_list)) { if (list_empty(&pdflush_list)) {