All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yusuf Khan <yusisamerican@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: linux-fpga@vger.kernel.org, yilun.xu@intel.com, mdf@kernel.org,
	trix@redhat.com, hao.wu@intel.com,
	Yusuf Khan <yusisamerican@gmail.com>
Subject: [PATCH -next] fpga: dfl: pci: Make sure DMA related error check is not done twice
Date: Mon, 28 Feb 2022 18:43:35 -0800	[thread overview]
Message-ID: <20220301024335.7155-1-yusisamerican@gmail.com> (raw)

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 --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);
-- 
2.25.1


                 reply	other threads:[~2022-03-01  2:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220301024335.7155-1-yusisamerican@gmail.com \
    --to=yusisamerican@gmail.com \
    --cc=hao.wu@intel.com \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mdf@kernel.org \
    --cc=trix@redhat.com \
    --cc=yilun.xu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.