summaryrefslogtreecommitdiff
path: root/drivers/scsi/fnic/fnic_scsi.c
diff options
context:
space:
mode:
authorMaurizio Lombardi <mlombard@redhat.com>2015-08-12 18:00:23 +0300
committerJames Bottomley <JBottomley@Odin.com>2015-10-27 05:05:45 +0300
commitfd6ddfa4c1ddfb4a149b31845144b4cf3cbef54d (patch)
tree846c774cf5b9bbb0a1991c4770bac1435d76d6ed /drivers/scsi/fnic/fnic_scsi.c
parentc4f39bdaf40e2651f4fb3e6944e05166f1ab1d38 (diff)
downloadlinux-fd6ddfa4c1ddfb4a149b31845144b4cf3cbef54d.tar.xz
fnic: check pci_map_single() return value
the kernel prints some warnings when compiled with CONFIG_DMA_API_DEBUG. This is because the fnic driver doesn't check the return value of pci_map_single(). [ 11.942770] scsi host12: fnic [ 11.950811] ------------[ cut here ]------------ [ 11.950818] WARNING: at lib/dma-debug.c:937 check_unmap+0x47b/0x920() [ 11.950821] fnic 0000:0c:00.0: DMA-API: device driver failed to check map error[device address=0x0000002020a30040] [size=44 bytes] [mapped as single] Signed-off-by: Maurizio Lombardi <mlombard@redhat.com> Reviewed-by: Johannes Thumshirn <jthumshirn@suse.de> Reviewed By: Tomas Henzl <thenzl@redhat.com> Signed-off-by: James Bottomley <JBottomley@Odin.com>
Diffstat (limited to 'drivers/scsi/fnic/fnic_scsi.c')
-rw-r--r--drivers/scsi/fnic/fnic_scsi.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/scsi/fnic/fnic_scsi.c b/drivers/scsi/fnic/fnic_scsi.c
index 25436cd2860c..266b909fe854 100644
--- a/drivers/scsi/fnic/fnic_scsi.c
+++ b/drivers/scsi/fnic/fnic_scsi.c
@@ -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 */