linux 2.6.16.38 w/ vs2.0.3-rc1
[linux-2.6.git] / drivers / block / cciss.c
index ff900aa..93e23d6 100644 (file)
@@ -38,7 +38,6 @@
 #include <linux/hdreg.h>
 #include <linux/spinlock.h>
 #include <linux/compat.h>
-#include <linux/blktrace_api.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
@@ -57,7 +56,6 @@ MODULE_DESCRIPTION("Driver for HP Controller SA5xxx SA6xxx version 2.6.10");
 MODULE_SUPPORTED_DEVICE("HP SA5i SA5i+ SA532 SA5300 SA5312 SA641 SA642 SA6400"
                        " SA6i P600 P800 P400 P400i E200 E200i");
 MODULE_LICENSE("GPL");
-MODULE_VERSION("2.6.8");
 
 #include "cciss_cmd.h"
 #include "cciss.h"
@@ -997,11 +995,13 @@ static int cciss_ioctl(struct inode *inode, struct file *filep,
                        status = -EINVAL;
                        goto cleanup1;
                }
-               buff = kzalloc(MAXSGENTRIES * sizeof(char *), GFP_KERNEL);
+               buff = (unsigned char **) kmalloc(MAXSGENTRIES * 
+                               sizeof(char *), GFP_KERNEL);
                if (!buff) {
                        status = -ENOMEM;
                        goto cleanup1;
                }
+               memset(buff, 0, MAXSGENTRIES);
                buff_size = (int *) kmalloc(MAXSGENTRIES * sizeof(int), 
                                        GFP_KERNEL);
                if (!buff_size) {
@@ -1218,6 +1218,12 @@ static void cciss_softirq_done(struct request *rq)
 
        complete_buffers(rq->bio, rq->errors);
 
+       if (blk_fs_request(rq)) {
+               const int rw = rq_data_dir(rq);
+
+               disk_stat_add(rq->rq_disk, sectors[rw], rq->nr_sectors);
+       }
+
 #ifdef CCISS_DEBUG
        printk("Done with %p\n", rq);
 #endif /* CCISS_DEBUG */
@@ -2186,7 +2192,7 @@ static void start_io( ctlr_info_t *h)
                        break;
                }
 
-               /* Get the first entry from the Request Q */ 
+               /* Get the frist entry from the Request Q */ 
                removeQ(&(h->reqQ), c);
                h->Qdepth--;
        
@@ -2333,7 +2339,6 @@ static inline void complete_command( ctlr_info_t *h, CommandList_struct *cmd,
 
        cmd->rq->completion_data = cmd;
        cmd->rq->errors = status;
-       blk_add_trace_rq(cmd->rq->q, cmd->rq, BLK_TA_COMPLETE);
        blk_complete_request(cmd->rq);
 }
 
@@ -2362,7 +2367,8 @@ queue:
        if (!creq)
                goto startio;
 
-       BUG_ON(creq->nr_phys_segments > MAXSGENTRIES);
+       if (creq->nr_phys_segments > MAXSGENTRIES)
+                BUG();
 
        if (( c = cmd_alloc(h, 1)) == NULL)
                goto full;
@@ -2730,9 +2736,9 @@ static void __devinit cciss_interrupt_mode(ctlr_info_t *c, struct pci_dev *pdev,
                         return;
                 }
         }
-default_int_mode:
 #endif /* CONFIG_PCI_MSI */
        /* if we get here we're going to use the default interrupt mode */
+default_int_mode:
         c->intr[SIMPLE_MODE_INT] = pdev->irq;
        return;
 }
@@ -2941,12 +2947,13 @@ static void cciss_getgeometry(int cntl_num)
        int block_size;
        int total_size; 
 
-       ld_buff = kzalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
+       ld_buff = kmalloc(sizeof(ReportLunData_struct), GFP_KERNEL);
        if (ld_buff == NULL)
        {
                printk(KERN_ERR "cciss: out of memory\n");
                return;
        }
+       memset(ld_buff, 0, sizeof(ReportLunData_struct));
        size_buff = kmalloc(sizeof( ReadCapdata_struct), GFP_KERNEL);
         if (size_buff == NULL)
         {
@@ -3060,9 +3067,10 @@ static int alloc_cciss_hba(void)
        for(i=0; i< MAX_CTLR; i++) {
                if (!hba[i]) {
                        ctlr_info_t *p;
-                       p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
+                       p = kmalloc(sizeof(ctlr_info_t), GFP_KERNEL);
                        if (!p)
                                goto Enomem;
+                       memset(p, 0, sizeof(ctlr_info_t));
                        for (n = 0; n < NWD; n++)
                                p->gendisk[n] = disk[n];
                        hba[i] = p;
@@ -3251,7 +3259,8 @@ static int __devinit cciss_init_one(struct pci_dev *pdev,
 
 clean4:
 #ifdef CONFIG_CISS_SCSI_TAPE
-       kfree(hba[i]->scsi_rejects.complete);
+       if(hba[i]->scsi_rejects.complete)
+               kfree(hba[i]->scsi_rejects.complete);
 #endif
        kfree(hba[i]->cmd_pool_bits);
        if(hba[i]->cmd_pool)