diff options
Diffstat (limited to 'drivers/scsi/eata.c')
-rw-r--r-- | drivers/scsi/eata.c | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/drivers/scsi/eata.c b/drivers/scsi/eata.c index a73a6bbb1b2b..976cdd5c94ef 100644 --- a/drivers/scsi/eata.c +++ b/drivers/scsi/eata.c | |||
@@ -1626,8 +1626,15 @@ static void map_dma(unsigned int i, struct hostdata *ha) | |||
1626 | 1626 | ||
1627 | cpp->sense_len = SCSI_SENSE_BUFFERSIZE; | 1627 | cpp->sense_len = SCSI_SENSE_BUFFERSIZE; |
1628 | 1628 | ||
1629 | count = scsi_dma_map(SCpnt); | 1629 | if (!scsi_sg_count(SCpnt)) { |
1630 | BUG_ON(count < 0); | 1630 | cpp->data_len = 0; |
1631 | return; | ||
1632 | } | ||
1633 | |||
1634 | count = pci_map_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt), | ||
1635 | pci_dir); | ||
1636 | BUG_ON(!count); | ||
1637 | |||
1631 | scsi_for_each_sg(SCpnt, sg, count, k) { | 1638 | scsi_for_each_sg(SCpnt, sg, count, k) { |
1632 | cpp->sglist[k].address = H2DEV(sg_dma_address(sg)); | 1639 | cpp->sglist[k].address = H2DEV(sg_dma_address(sg)); |
1633 | cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg)); | 1640 | cpp->sglist[k].num_bytes = H2DEV(sg_dma_len(sg)); |
@@ -1655,7 +1662,9 @@ static void unmap_dma(unsigned int i, struct hostdata *ha) | |||
1655 | pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr), | 1662 | pci_unmap_single(ha->pdev, DEV2H(cpp->sense_addr), |
1656 | DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); | 1663 | DEV2H(cpp->sense_len), PCI_DMA_FROMDEVICE); |
1657 | 1664 | ||
1658 | scsi_dma_unmap(SCpnt); | 1665 | if (scsi_sg_count(SCpnt)) |
1666 | pci_unmap_sg(ha->pdev, scsi_sglist(SCpnt), scsi_sg_count(SCpnt), | ||
1667 | pci_dir); | ||
1659 | 1668 | ||
1660 | if (!DEV2H(cpp->data_len)) | 1669 | if (!DEV2H(cpp->data_len)) |
1661 | pci_dir = PCI_DMA_BIDIRECTIONAL; | 1670 | pci_dir = PCI_DMA_BIDIRECTIONAL; |