[SCSI] aic7xxx: fix IOMMU mapping failure handling
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Sun, 9 Mar 2008 13:50:41 +0000 (22:50 +0900)
committerJames Bottomley <James.Bottomley@HansenPartnership.com>
Mon, 7 Apr 2008 17:15:44 +0000 (12:15 -0500)
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
drivers/scsi/aic7xxx/aic7xxx_osm.c

index 282aff6f852e85bb5b9bae950e2da1f423e5df34..42ad48e09f022ae4409338a225a818c111527611 100644 (file)
@@ -1398,12 +1398,18 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
                        return SCSI_MLQUEUE_DEVICE_BUSY;
        }
 
+       nseg = scsi_dma_map(cmd);
+       if (nseg < 0)
+               return SCSI_MLQUEUE_HOST_BUSY;
+
        /*
         * Get an scb to use.
         */
        scb = ahc_get_scb(ahc);
-       if (!scb)
+       if (!scb) {
+               scsi_dma_unmap(cmd);
                return SCSI_MLQUEUE_HOST_BUSY;
+       }
 
        scb->io_ctx = cmd;
        scb->platform_data->dev = dev;
@@ -1464,8 +1470,6 @@ ahc_linux_run_command(struct ahc_softc *ahc, struct ahc_linux_device *dev,
        ahc_set_sense_residual(scb, 0);
        scb->sg_count = 0;
 
-       nseg = scsi_dma_map(cmd);
-       BUG_ON(nseg < 0);
        if (nseg > 0) {
                struct  ahc_dma_seg *sg;
                struct  scatterlist *cur_seg;