Skip to contentSkip to conversation

scsi: csiostor: fix incorrect if condition for setting dma mask

PATCH In review Varun Prakash 2 participants 2 messages Feb 20, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 scsi: csiostor: fix incorrect if condition for setting dma mask

Use && instead of || in if condition as
dma_set_mask_and_coherent() returns 0 on success.

Fixes c22b332d811b ("scsi: csiostor: switch to generic DMA API")
Cc Christoph Hellwig <[email protected]>
---
 drivers/scsi/csiostor/csio_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_init.c +1 -1
index cf629380a981..e7ad7b1a0440 100644
@@ -210,7 +210,7 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
 	pci_set_master(pdev);
 	pci_try_set_mwi(pdev);
 
-	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
+	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) &&
 	    dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
 		dev_err(&pdev->dev, "No suitable DMA available.\n");
 		goto err_release_regions;
Signature · 1 line
2.0.2
#1 lore raw
Quoted 17 lines · Varun Prakash

Use && instead of || in if condition as
dma_set_mask_and_coherent() returns 0 on success.

Fixes c22b332d811b ("scsi: csiostor: switch to generic DMA API")
Cc Christoph Hellwig <[email protected]>
---
 drivers/scsi/csiostor/csio_init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/csiostor/csio_init.c +0 -0
index cf629380a981..e7ad7b1a0440 100644

drivers/scsi/csiostor/csio_init.c csio_pci_init(struct pci_dev *pdev, int *bars) · line 216

Quoted 8 lines
drivers/scsi/csiostor/csio_init.c +1 -1
@@ -210,7 +210,7 @@ csio_pci_init(struct pci_dev *pdev, int *bars)
 	pci_set_master(pdev);
 	pci_try_set_mwi(pdev);
 
-	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) ||
+	if (dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)) &&
 	    dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) {
 		dev_err(&pdev->dev, "No suitable DMA available.\n");
 		goto err_release_regions;

I think Hannes already sent a fix for this:
https://marc.info/?l=linux-scsi&m=155047528202096&w=2

Thanks