]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/scsi/a100u2w.c
Merge branches 'timers/clocksource', 'timers/hpet', 'timers/hrtimers', 'timers/nohz...
[linux-2.6-omap-h63xx.git] / drivers / scsi / a100u2w.c
index 1dd0fcfe1d7056812dfa603f4ba675b24a9e4daa..84bb61628372faca2e104baf3911aab33727e752 100644 (file)
@@ -401,6 +401,7 @@ static u8 orc_load_firmware(struct orc_host * host)
 
        /* Copy the code from the BIOS to the SRAM */
 
+       udelay(500);    /* Required on Sun Ultra 5 ... 350 -> failures */
        bios_addr = (u16) le32_to_cpu(data32);  /* FW code locate at BIOS address + ? */
        for (i = 0, data32_ptr = (u8 *) & data32;       /* Download the code    */
             i < 0x1000;        /* Firmware code size = 4K      */
@@ -839,7 +840,7 @@ static irqreturn_t orc_interrupt(struct orc_host * host)
  *     Build a host adapter control block from the SCSI mid layer command
  */
 
-static void inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struct scsi_cmnd * cmd)
+static int inia100_build_scb(struct orc_host * host, struct orc_scb * scb, struct scsi_cmnd * cmd)
 {                              /* Create corresponding SCB     */
        struct scatterlist *sg;
        struct orc_sgent *sgent;                /* Pointer to SG list           */
@@ -864,7 +865,9 @@ static void inia100_build_scb(struct orc_host * host, struct orc_scb * scb, stru
        sgent = (struct orc_sgent *) & escb->sglist[0];
 
        count_sg = scsi_dma_map(cmd);
-       BUG_ON(count_sg < 0);
+       if (count_sg < 0)
+               return count_sg;
+       BUG_ON(count_sg > TOTAL_SG_ENTRY);
 
        /* Build the scatter gather lists */
        if (count_sg) {
@@ -896,6 +899,7 @@ static void inia100_build_scb(struct orc_host * host, struct orc_scb * scb, stru
                scb->tag_msg = 0;       /* No tag support               */
        }
        memcpy(scb->cdb, cmd->cmnd, scb->cdb_len);
+       return 0;
 }
 
 /**
@@ -919,7 +923,10 @@ static int inia100_queue(struct scsi_cmnd * cmd, void (*done) (struct scsi_cmnd
        if ((scb = orc_alloc_scb(host)) == NULL)
                return SCSI_MLQUEUE_HOST_BUSY;
 
-       inia100_build_scb(host, scb, cmd);
+       if (inia100_build_scb(host, scb, cmd)) {
+               orc_release_scb(host, scb);
+               return SCSI_MLQUEUE_HOST_BUSY;
+       }
        orc_exec_scb(host, scb);        /* Start execute SCB            */
        return 0;
 }