On Sat, Apr 22, 2017 at 02:17:50AM +0300, Alexey Khoroshilov wrote: > } else { > - scmd->SCp.dma_handle = scsi_bufflen(scmd) ? > - pci_map_single(mhba->pdev, scsi_sglist(scmd), > - scsi_bufflen(scmd), > - (int) scmd->sc_data_direction) > - : 0; > + if (!scsi_bufflen(scmd)) > + return -1; > + scmd->SCp.dma_handle = pci_map_single(mhba->pdev, > + scsi_sglist(scmd), > + scsi_bufflen(scmd), > + (int) scmd->sc_data_direction); > + if (pci_dma_mapping_error(mhba->pdev, scmd->SCp.dma_handle)) > + return -1; This looks completely broken. Why would you DMA map the in-memory struct scatterlist? It has no meaning for the hardware. In fact this whole branch (and the equivalent in the unmap path) are dead - SCSI commands that transfer data always have a SG entry. So the right fix is to remove the !scsi_sg_count(scmd) map/unmap path.