nfsd4: setclientid_confirm callback-change fixes
[safe/jmp/linux-2.6] / drivers / scsi / a100u2w.c
index 1e8bdd4..208d6df 100644 (file)
@@ -54,7 +54,7 @@
  * 9/28/04 Christoph Hellwig <hch@lst.de>
  *         - merge the two source files
  *         - remove internal queueing code
- * 14/06/07 Alan Cox <alan@redhat.com>
+ * 14/06/07 Alan Cox <alan@lxorguk.ukuu.org.uk>
  *      - Grand cleanup and Linuxisation
  */
 
@@ -633,7 +633,7 @@ static int orc_device_reset(struct orc_host * host, struct scsi_cmnd *cmd, unsig
                return FAILED;
        }
 
-       /* Reset device is handled by the firmare, we fill in an SCB and
+       /* Reset device is handled by the firmware, we fill in an SCB and
           fire it at the controller, it does the rest */
        scb->opcode = ORC_BUSDEVRST;
        scb->target = target;
@@ -840,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           */
@@ -865,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) {
@@ -897,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;
 }
 
 /**
@@ -920,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;
 }
@@ -1088,7 +1094,7 @@ static int __devinit inia100_probe_one(struct pci_dev *pdev,
 
        if (pci_enable_device(pdev))
                goto out;
-       if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(pdev, DMA_BIT_MASK(32))) {
                printk(KERN_WARNING "Unable to set 32bit DMA "
                                    "on inia100 adapter, ignoring.\n");
                goto out_disable_device;