VServer 1.9.2 (patch-2.6.8.1-vs1.9.2.diff)
[linux-2.6.git] / drivers / scsi / aacraid / sa.c
index 494d1fd..23e3b76 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/blkdev.h>
 #include <linux/delay.h>
 #include <linux/completion.h>
+#include <linux/time.h>
 #include <linux/interrupt.h>
 #include <asm/semaphore.h>
 
@@ -329,27 +330,24 @@ static int aac_sa_check_health(struct aac_dev *dev)
         *      Everything is OK
         */
        return 0;
-} /* aac_sa_check_health */
+}
 
 /**
  *     aac_sa_init     -       initialize an ARM based AAC card
  *     @dev: device to configure
- *     @devnum: adapter number
  *
  *     Allocate and set up resources for the ARM based AAC variants. The 
  *     device_interface in the commregion will be allocated and linked 
  *     to the comm region.
  */
 
-int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
+int aac_sa_init(struct aac_dev *dev)
 {
        unsigned long start;
        unsigned long status;
        int instance;
        const char *name;
 
-       dev->devnum = devnum;
-
        dprintk(("PREINST\n"));
        instance = dev->id;
        name     = dev->name;
@@ -362,21 +360,21 @@ int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
        if((dev->regs.sa = (struct sa_registers *)ioremap((unsigned long)dev->scsi_host_ptr->base, 8192))==NULL)
        {       
                printk(KERN_WARNING "aacraid: unable to map ARM.\n" );
-               return -1;
+               goto error_iounmap;
        }
        /*
         *      Check to see if the board failed any self tests.
         */
        if (sa_readl(dev, Mailbox7) & SELF_TEST_FAILED) {
                printk(KERN_WARNING "%s%d: adapter self-test failed.\n", name, instance);
-               return -1;
+               goto error_iounmap;
        }
        /*
         *      Check to see if the board panic'd while booting.
         */
        if (sa_readl(dev, Mailbox7) & KERNEL_PANIC) {
                printk(KERN_WARNING "%s%d: adapter kernel panic'd.\n", name, instance);
-               return -1;
+               goto error_iounmap;
        }
        start = jiffies;
        /*
@@ -386,7 +384,7 @@ int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
                if (time_after(jiffies, start+180*HZ)) {
                        status = sa_readl(dev, Mailbox7) >> 16;
                        printk(KERN_WARNING "%s%d: adapter kernel failed to start, init status = %d.\n", name, instance, le32_to_cpu(status));
-                       return -1;
+                       goto error_iounmap;
                }
                set_current_state(TASK_UNINTERRUPTIBLE);
                schedule_timeout(1);
@@ -395,7 +393,7 @@ int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
        dprintk(("ATIRQ\n"));
        if (request_irq(dev->scsi_host_ptr->irq, aac_sa_intr, SA_SHIRQ|SA_INTERRUPT, "aacraid", (void *)dev ) < 0) {
                printk(KERN_WARNING "%s%d: Interrupt unavailable.\n", name, instance);
-               return -1;
+               goto error_iounmap;
        }
 
        /*
@@ -412,7 +410,7 @@ int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
        dprintk(("FUNCDONE\n"));
 
        if(aac_init_adapter(dev) == NULL)
-               return -1;
+               goto error_irq;
 
        dprintk(("NEWADAPTDONE\n"));
        /*
@@ -421,7 +419,7 @@ int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
        dev->thread_pid = kernel_thread((int (*)(void *))aac_command_thread, dev, 0);
        if (dev->thread_pid < 0) {
                printk(KERN_ERR "aacraid: Unable to create command thread.\n");
-               return -1;
+               goto error_kfree;
        }
 
        /*
@@ -432,5 +430,17 @@ int aac_sa_init(struct aac_dev *dev, unsigned long devnum)
        aac_sa_start_adapter(dev);
        dprintk(("STARTED\n"));
        return 0;
+
+
+error_kfree:
+       kfree(dev->queues);
+
+error_irq:
+       free_irq(dev->scsi_host_ptr->irq, (void *)dev);
+
+error_iounmap:
+       iounmap(dev->regs.sa);
+
+       return -1;
 }