diff options
author | Hannes Reinecke <hare@suse.de> | 2019-02-18 02:34:23 -0500 |
---|---|---|
committer | Martin K. Petersen <martin.petersen@oracle.com> | 2019-02-25 21:44:29 -0500 |
commit | 11ea3824140ca994f4560c4bec6a32d257ef3e83 (patch) | |
tree | 8591bd2710a42d84310e14bdec717d506e674a43 | |
parent | c326de562f1fc149da4855a1b9d0433300c2a85d (diff) |
scsi: bfa: fix calls to dma_set_mask_and_coherent()
The change to use dma_set_mask_and_coherent() incorrectly made a second
call with the 32 bit DMA mask value when the call with the 64 bit DMA mask
value succeeded.
[mkp: fixed commit message]
Fixes: a69b080025ea ("scsi: bfa: use dma_set_mask_and_coherent")
Cc: <stable@vger.kernel.org>
Suggested-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Ewan D. Milne <emilne@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
-rw-r--r-- | drivers/scsi/bfa/bfad.c | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/drivers/scsi/bfa/bfad.c b/drivers/scsi/bfa/bfad.c index 42a0caf6740d..88880a66a189 100644 --- a/drivers/scsi/bfa/bfad.c +++ b/drivers/scsi/bfa/bfad.c | |||
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad) | |||
727 | int | 727 | int |
728 | bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) | 728 | bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) |
729 | { | 729 | { |
730 | int rc = -ENODEV; | 730 | int rc = -ENODEV; |
731 | 731 | ||
732 | if (pci_enable_device(pdev)) { | 732 | if (pci_enable_device(pdev)) { |
733 | printk(KERN_ERR "pci_enable_device fail %p\n", pdev); | 733 | printk(KERN_ERR "pci_enable_device fail %p\n", pdev); |
@@ -739,8 +739,12 @@ bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad) | |||
739 | 739 | ||
740 | pci_set_master(pdev); | 740 | pci_set_master(pdev); |
741 | 741 | ||
742 | if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) || | 742 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); |
743 | dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { | 743 | if (rc) |
744 | rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)); | ||
745 | |||
746 | if (rc) { | ||
747 | rc = -ENODEV; | ||
744 | printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); | 748 | printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev); |
745 | goto out_release_region; | 749 | goto out_release_region; |
746 | } | 750 | } |
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev) | |||
1534 | { | 1538 | { |
1535 | struct bfad_s *bfad = pci_get_drvdata(pdev); | 1539 | struct bfad_s *bfad = pci_get_drvdata(pdev); |
1536 | u8 byte; | 1540 | u8 byte; |
1541 | int rc; | ||
1537 | 1542 | ||
1538 | dev_printk(KERN_ERR, &pdev->dev, | 1543 | dev_printk(KERN_ERR, &pdev->dev, |
1539 | "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags); | 1544 | "bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags); |
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev) | |||
1561 | pci_save_state(pdev); | 1566 | pci_save_state(pdev); |
1562 | pci_set_master(pdev); | 1567 | pci_set_master(pdev); |
1563 | 1568 | ||
1564 | if (dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)) || | 1569 | rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64)); |
1565 | dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(32))) | 1570 | if (rc) |
1571 | rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, | ||
1572 | DMA_BIT_MASK(32)); | ||
1573 | if (rc) | ||
1566 | goto out_disable_device; | 1574 | goto out_disable_device; |
1567 | 1575 | ||
1568 | if (restart_bfa(bfad) == -1) | 1576 | if (restart_bfa(bfad) == -1) |