These changes are the raw update to linux-4.4.6-rt14. Kernel sources
[kvmfornfv.git] / kernel / drivers / scsi / fnic / fnic_scsi.c
index 25436cd..266b909 100644 (file)
@@ -330,6 +330,7 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
        int flags;
        u8 exch_flags;
        struct scsi_lun fc_lun;
+       int r;
 
        if (sg_count) {
                /* For each SGE, create a device desc entry */
@@ -346,6 +347,12 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
                         io_req->sgl_list,
                         sizeof(io_req->sgl_list[0]) * sg_count,
                         PCI_DMA_TODEVICE);
+
+               r = pci_dma_mapping_error(fnic->pdev, io_req->sgl_list_pa);
+               if (r) {
+                       printk(KERN_ERR "PCI mapping failed with error %d\n", r);
+                       return SCSI_MLQUEUE_HOST_BUSY;
+               }
        }
 
        io_req->sense_buf_pa = pci_map_single(fnic->pdev,
@@ -353,6 +360,15 @@ static inline int fnic_queue_wq_copy_desc(struct fnic *fnic,
                                              SCSI_SENSE_BUFFERSIZE,
                                              PCI_DMA_FROMDEVICE);
 
+       r = pci_dma_mapping_error(fnic->pdev, io_req->sense_buf_pa);
+       if (r) {
+               pci_unmap_single(fnic->pdev, io_req->sgl_list_pa,
+                               sizeof(io_req->sgl_list[0]) * sg_count,
+                               PCI_DMA_TODEVICE);
+               printk(KERN_ERR "PCI mapping failed with error %d\n", r);
+               return SCSI_MLQUEUE_HOST_BUSY;
+       }
+
        int_to_scsilun(sc->device->lun, &fc_lun);
 
        /* Enqueue the descriptor in the Copy WQ */