diff mbox series

[-next] fpga: dfl: pci: Make sure DMA related error check is not done twice

Message ID 20220301024335.7155-1-yusisamerican@gmail.com (mailing list archive)
State New
Headers show
Series [-next] fpga: dfl: pci: Make sure DMA related error check is not done twice | expand

Commit Message

Yusuf Khan March 1, 2022, 2:43 a.m. UTC
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.

Signed-off-by: Yusuf Khan <yusisamerican@gmail.com>
---
 drivers/fpga/dfl-pci.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/fpga/dfl-pci.c b/drivers/fpga/dfl-pci.c
index 717ac9715970..6222f18aed4b 100644
--- a/drivers/fpga/dfl-pci.c
+++ b/drivers/fpga/dfl-pci.c
@@ -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);