Skip to contentSkip to conversation

fpga: dfl: pci: Make sure DMA related error check is not done twice

PATCH New Yusuf Khan 1 participant 1 message Mar 1, 2022

Subsystems (2)
lore
Share & tools
lore

Yusuf Khan

author
#0 lore raw

PATCH 1/1 fpga: dfl: pci: Make sure DMA related error check is not done twice

In the case that the DMA 64 bit bit mask error check does not fail, the error check will be done twice, this patch fixed that.

---
 drivers/fpga/dfl-pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
drivers/fpga/dfl-pci.c +5 -4
index 717ac9715970..6222f18aed4b 100644
@@ -356,11 +356,12 @@ int cci_pci_probe(struct pci_dev *pcidev, const struct pci_device_id *pcidevid)
 	pci_set_master(pcidev);
 
 	ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(64));
-	if (ret)
-		ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
 	if (ret) {
-		dev_err(&pcidev->dev, "No suitable DMA support available.\n");
-		goto disable_error_report_exit;
+		ret = dma_set_mask_and_coherent(&pcidev->dev, DMA_BIT_MASK(32));
+		if (ret) {
+			dev_err(&pcidev->dev, "No suitable DMA support available.\n");
+			goto disable_error_report_exit;
+		}
 	}
 
 	ret = cci_init_drvdata(pcidev);
Signature · 1 line
2.25.1