]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
[PATCH] More BUG_ON conversion
authorEric Sesterhenn <snakebyte@gmx.de>
Fri, 23 Jun 2006 09:06:06 +0000 (02:06 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Fri, 23 Jun 2006 14:43:08 +0000 (07:43 -0700)
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>
18 files changed:
arch/frv/kernel/setup.c
drivers/ide/ide-cd.c
drivers/ide/ide-dma.c
drivers/ide/ide-floppy.c
drivers/ide/ide-iops.c
drivers/ide/ide-lib.c
drivers/ide/ide-taskfile.c
drivers/ide/ide.c
drivers/ide/pci/trm290.c
drivers/scsi/53c700.h
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/commsup.c
drivers/scsi/arm/queue.c
drivers/scsi/ibmmca.c
drivers/scsi/ide-scsi.c
drivers/scsi/megaraid.c
kernel/exit.c
mm/pdflush.c

index 5908deae9607b7a5c991c3a6e4176d93f7248095..1f7d65f29e78cc0963211acf42215dd57943fa0b 100644 (file)
@@ -814,7 +814,7 @@ void __init setup_arch(char **cmdline_p)
         * - by now the stack is part of the init task */
        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.end_code = (unsigned long) &_etext;
index abb83d95df573d1043fcda96b2ad11f5b36ff8bf..6de3cd3d6e8e266a4fd7cad57729c5a419d506cc 100644 (file)
@@ -1725,8 +1725,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
                }
        }
 
-       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;
index c481be8b807f6fe9345ce20bdfd0da16d8eaeee2..783a2475ee8b12519e33adac7e69f1c55219b22d 100644 (file)
@@ -206,8 +206,7 @@ int ide_build_sglist(ide_drive_t *drive, struct request *rq)
        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, unsigned long dma_base, unsigned int num_p
        }
        printk("\n");
 
-       if (!(hwif->dma_master))
-               BUG();
+       BUG_ON(!hwif->dma_master);
 }
 
 EXPORT_SYMBOL_GPL(ide_setup_dma);
index a53e3ce4a14211435965c00aca679d979deb5ad2..a1179e924962586335ab733c7c66e99f20209387 100644 (file)
@@ -898,8 +898,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
                                        "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,
@@ -932,8 +931,7 @@ static ide_startstop_t idefloppy_pc_intr (ide_drive_t *drive)
        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;
 }
@@ -960,8 +958,7 @@ static ide_startstop_t idefloppy_transfer_pc (ide_drive_t *drive)
                                "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 */
@@ -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
         * 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" */
index b72dde70840a797f3279021aecd4b080491e2663..97a49e77a8f1f5d30d906847f202ad85ea2f08c8 100644 (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);
        
-       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_pollfunc (ide_drive_t *drive)
                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 (ide_drive_t *drive)
 
        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_drive_t *drive, int do_not_try_atapi)
        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) {
index 41d46dbe6c24c0e68ee546633100caf93839d9d0..16a143133f938f12771328b2a5049dc2957a8692 100644 (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);
 
        /* 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);
index 9233b8109a0f3a492d86471850870bf122dd90ce..a839b2a8f6f485d17f30a1d861bbb7ecb7deda63 100644 (file)
@@ -196,8 +196,7 @@ ide_startstop_t set_geometry_intr (ide_drive_t *drive)
        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;
 }
index f5a60912c27187932d6c770cc274292dd2b9afa8..9799aed772e126c6d868a87cfaae6d579284951d 100644 (file)
@@ -1367,8 +1367,7 @@ int generic_ide_ioctl(ide_drive_t *drive, struct file *file, struct block_device
 
                        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 */
index c26c8ca90dd47eaea93fe4b538fe3bd799417dd7..fe80295974e15b5a4269e05bf672ca4851ccae15 100644 (file)
@@ -183,8 +183,7 @@ static void trm290_ide_dma_exec_cmd(ide_drive_t *drive, u8 command)
 {
        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);
index d8041952b1b536183a1d5fa02a47487b681410a0..7f22a06fe5ec5cb80dd6dec7157d3d705a2a0e53 100644 (file)
@@ -474,8 +474,7 @@ NCR_700_readl(struct Scsi_Host *host, __u32 reg)
                ioread32(hostdata->base + reg);
 #if 1
        /* sanity check the register */
-       if((reg & 0x3) != 0)
-               BUG();
+       BUG_ON((reg & 0x3) != 0);
 #endif
 
        return value;
@@ -498,8 +497,7 @@ NCR_700_writel(__u32 value, struct Scsi_Host *host, __u32 reg)
 
 #if 1
        /* sanity check the register */
-       if((reg & 0x3) != 0)
-               BUG();
+       BUG_ON((reg & 0x3) != 0);
 #endif
 
        bEBus ? iowrite32be(value, hostdata->base + reg): 
index ea9e038813eb6092f82b2cc506675f01c24b46ec..83b5c7d085f23b972a9078766c13f1191a7854df 100644 (file)
@@ -396,8 +396,7 @@ static void get_container_name_callback(void *context, struct fib * fibptr)
        scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
 
        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 */
@@ -956,8 +955,7 @@ static void io_callback(void *context, struct fib * fibptr)
                  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, 
@@ -1092,8 +1090,7 @@ static int aac_read(struct scsi_cmnd * scsicmd, int cid)
                
                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
                 */
@@ -1261,8 +1258,7 @@ static int aac_write(struct scsi_cmnd * scsicmd, int cid)
                
                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
                 */
@@ -1904,8 +1900,7 @@ static void aac_srb_callback(void *context, struct fib * fibptr)
        scsicmd->SCp.phase = AAC_OWNER_MIDLEVEL;
        dev = (struct aac_dev *)scsicmd->device->host->hostdata;
 
-       if (fibptr == NULL)
-               BUG();
+       BUG_ON(fibptr == NULL);
 
        srbreply = (struct aac_srb_reply *) fib_data(fibptr);
 
index d2ef17ea44fa640c82e68e6001258aa2199a5f4c..3f27419c66af6c7abac2af838304b3650a8756c8 100644 (file)
@@ -229,8 +229,7 @@ void aac_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();
+       BUG_ON(hw_fib->header.StructType != FIB_MAGIC);
        hw_fib->header.XferState = 0;        
 }
 
@@ -530,8 +529,7 @@ int aac_fib_send(u16 command, struct fib *fibptr, unsigned long size,
                        }
                } 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;
index b10750bb5c09b428687419376507190f125afec4..8caa5903ce3841d3ee9c4b3f7f1443ce7fb349b9 100644 (file)
@@ -118,8 +118,7 @@ int __queue_add(Queue_t *queue, Scsi_Cmnd *SCpnt, int head)
        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 *queue, struct list_head *ent)
         */
        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);
index 0c6dc31bb14dee7fe66849da86d0d94c300b560c..115f55471ed3be2d1ffe5112d0db8aaeb607e325 100644 (file)
@@ -2241,8 +2241,7 @@ static int __ibmmca_host_reset(Scsi_Cmnd * cmd)
        int host_index;
        unsigned long imm_command;
 
-       if (cmd == NULL)
-               BUG();
+       BUG_ON(cmd == NULL);
 
        ticks = IM_RESET_DELAY * HZ;
        shpnt = cmd->device->host;
index 39b760a2424160c518d3415ef0fc9f4e44843762..988e6f7af01a28d4a5bf9fc67e3b2428696279ea 100644 (file)
@@ -600,8 +600,7 @@ static ide_startstop_t idescsi_transfer_pc(ide_drive_t *drive)
                                "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 */
@@ -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);
 
        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 */
index c33857e7b33b6a669b5ff029958fc131ce084d5b..5d2cefb5e52d242a56fe47a24ebbc3fa4063a6e9 100644 (file)
@@ -1828,7 +1828,7 @@ mega_build_sglist(adapter_t *adapter, scb_t *scb, u32 *buf, u32 *len)
 
        scb->dma_type = MEGA_SGLIST;
 
-       if( sgcnt > adapter->sglen ) BUG();
+       BUG_ON(sgcnt > adapter->sglen);
 
        *len = 0;
 
index e06d0c10a24e2f4e054d17c21d032beadf8d1ba6..a3baf92462bd6d1acf855938f619c1888ba011f1 100644 (file)
@@ -579,7 +579,7 @@ static void exit_mm(struct task_struct * tsk)
                down_read(&mm->mmap_sem);
        }
        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 */
        task_lock(tsk);
        tsk->mm = NULL;
@@ -1530,8 +1530,7 @@ check_continued:
                if (options & __WNOTHREAD)
                        break;
                tsk = next_thread(tsk);
-               if (tsk->signal != current->signal)
-                       BUG();
+               BUG_ON(tsk->signal != current->signal);
        } while (tsk != current);
 
        read_unlock(&tasklist_lock);
index c4b6d0afd73605cdc446a1cd9fc75aca8afb3693..df7e50b8f70c1350a404d446a62e0845b6235bf1 100644 (file)
@@ -202,8 +202,7 @@ int pdflush_operation(void (*fn)(unsigned long), unsigned long arg0)
        unsigned long flags;
        int ret = 0;
 
-       if (fn == NULL)
-               BUG();          /* Hard to diagnose if it's deferred */
+       BUG_ON(fn == NULL);     /* Hard to diagnose if it's deferred */
 
        spin_lock_irqsave(&pdflush_lock, flags);
        if (list_empty(&pdflush_list)) {