fnic: pci_dma_mapping_error() doesn't return an error code
authorDan Carpenter <dan.carpenter@oracle.com>
Thu, 7 Jul 2016 08:23:59 +0000 (11:23 +0300)
committerMartin K. Petersen <martin.petersen@oracle.com>
Thu, 21 Jul 2016 00:49:17 +0000 (20:49 -0400)
pci_dma_mapping_error() returns true on error and false on success.

Fixes: fd6ddfa4c1dd ('fnic: check pci_map_single() return value')
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
drivers/scsi/fnic/fnic_fcs.c

index 0d532ae273ebfba579e1af28dde75a9c13b5e353..3b7da66e277188c5e5a14d5c4f18b6942f2f2dc8 100644 (file)
@@ -954,8 +954,8 @@ int fnic_alloc_rq_frame(struct vnic_rq *rq)
        skb_put(skb, len);
        pa = pci_map_single(fnic->pdev, skb->data, len, PCI_DMA_FROMDEVICE);
 
-       r = pci_dma_mapping_error(fnic->pdev, pa);
-       if (r) {
+       if (pci_dma_mapping_error(fnic->pdev, pa)) {
+               r = -ENOMEM;
                printk(KERN_ERR "PCI mapping failed with error %d\n", r);
                goto free_skb;
        }
@@ -1093,8 +1093,8 @@ static int fnic_send_frame(struct fnic *fnic, struct fc_frame *fp)
 
        pa = pci_map_single(fnic->pdev, eth_hdr, tot_len, PCI_DMA_TODEVICE);
 
-       ret = pci_dma_mapping_error(fnic->pdev, pa);
-       if (ret) {
+       if (pci_dma_mapping_error(fnic->pdev, pa)) {
+               ret = -ENOMEM;
                printk(KERN_ERR "DMA map failed with error %d\n", ret);
                goto free_skb_on_err;
        }