* data bde entry.
*/
bpl += 2;
- nseg = scsi_dma_map(scsi_cmnd);
- if (nseg > 0) {
+ if (scsi_sg_count(scsi_cmnd)) {
/*
* The driver stores the segment count returned from pci_map_sg
* because this a count of dma-mappings used to map the use_sg
* architectures that implement an IOMMU.
*/
+ nseg = dma_map_sg(&phba->pcidev->dev, scsi_sglist(scsi_cmnd),
+ scsi_sg_count(scsi_cmnd), datadir);
+ if (unlikely(!nseg))
+ return 1;
+
lpfc_cmd->seg_cnt = nseg;
if (lpfc_cmd->seg_cnt > phba->cfg_sg_seg_cnt) {
printk(KERN_ERR "%s: Too many sg segments from "
bpl++;
num_bde++;
}
- } else if (nseg < 0)
- return 1;
+ }
/*
* Finish initializing those IOCB fields that are dependent on the