Skip to content

Commit 1feb3b0

Browse files
hreineckemartinkpetersen
authored andcommitted
scsi: 3w-sas: 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. Fixes: b1fa122 ("scsi: 3w-sas: fully convert to the generic DMA API") Cc: <stable@vger.kernel.org> 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 33d6667 commit 1feb3b0

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/scsi/3w-sas.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1572,8 +1572,10 @@ static int twl_probe(struct pci_dev *pdev, const struct pci_device_id *dev_id)
15721572
pci_set_master(pdev);
15731573
pci_try_set_mwi(pdev);
15741574

1575-
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1576-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1575+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1576+
if (retval)
1577+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1578+
if (retval) {
15771579
TW_PRINTK(host, TW_DRIVER, 0x18, "Failed to set dma mask");
15781580
retval = -ENODEV;
15791581
goto out_disable_device;
@@ -1804,8 +1806,10 @@ static int twl_resume(struct pci_dev *pdev)
18041806
pci_set_master(pdev);
18051807
pci_try_set_mwi(pdev);
18061808

1807-
if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
1808-
dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
1809+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
1810+
if (retval)
1811+
retval = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32));
1812+
if (retval) {
18091813
TW_PRINTK(host, TW_DRIVER, 0x25, "Failed to set dma mask during resume");
18101814
retval = -ENODEV;
18111815
goto out_disable_device;

0 commit comments

Comments
 (0)