Skip to content

Commit 11ea382

Browse files
hreineckemartinkpetersen
authored andcommitted
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: a69b080 ("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>
1 parent c326de5 commit 11ea382

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

drivers/scsi/bfa/bfad.c

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,7 @@ bfad_init_timer(struct bfad_s *bfad)
727727
int
728728
bfad_pci_init(struct pci_dev *pdev, struct bfad_s *bfad)
729729
{
730-
int rc = -ENODEV;
730+
int rc = -ENODEV;
731731

732732
if (pci_enable_device(pdev)) {
733733
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)
739739

740740
pci_set_master(pdev);
741741

742-
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
743-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
742+
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
743+
if (rc)
744+
rc = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
745+
746+
if (rc) {
747+
rc = -ENODEV;
744748
printk(KERN_ERR "dma_set_mask_and_coherent fail %p\n", pdev);
745749
goto out_release_region;
746750
}
@@ -1534,6 +1538,7 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15341538
{
15351539
struct bfad_s *bfad = pci_get_drvdata(pdev);
15361540
u8 byte;
1541+
int rc;
15371542

15381543
dev_printk(KERN_ERR, &pdev->dev,
15391544
"bfad_pci_slot_reset flags: 0x%x\n", bfad->bfad_flags);
@@ -1561,8 +1566,11 @@ bfad_pci_slot_reset(struct pci_dev *pdev)
15611566
pci_save_state(pdev);
15621567
pci_set_master(pdev);
15631568

1564-
if (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)))
1569+
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev, DMA_BIT_MASK(64));
1570+
if (rc)
1571+
rc = dma_set_mask_and_coherent(&bfad->pcidev->dev,
1572+
DMA_BIT_MASK(32));
1573+
if (rc)
15661574
goto out_disable_device;
15671575

15681576
if (restart_bfa(bfad) == -1)

0 commit comments

Comments
 (0)