mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Zheyu Ma <zheyuma97@gmail.com>
To: mporter@kernel.crashing.org, alex.bou9@gmail.com
Cc: linux-kernel@vger.kernel.org, Zheyu Ma <zheyuma97@gmail.com>
Subject: [PATCH] rapidio: tsi721: handle errors properly inside tsi721_probe()
Date: Tue, 22 Jun 2021 08:57:19 +0000	[thread overview]
Message-ID: <1624352239-6179-1-git-send-email-zheyuma97@gmail.com> (raw)

BUG_on() is a too drastic measure, remove them. Instead, just output
error message and exit.

Signed-off-by: Zheyu Ma <zheyuma97@gmail.com>
---
 drivers/rapidio/devices/tsi721.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c
index 4dd31dd9feea..92ec5081e5fb 100644
--- a/drivers/rapidio/devices/tsi721.c
+++ b/drivers/rapidio/devices/tsi721.c
@@ -2851,7 +2851,10 @@ static int tsi721_probe(struct pci_dev *pdev,
 			tsi_info(&pdev->dev, "Unable to set consistent DMA mask");
 	}
 
-	BUG_ON(!pci_is_pcie(pdev));
+	if (!pci_is_pcie(pdev)) {
+		tsi_err(&pdev->dev, "Can't find PCI Express capability");
+		goto err_unmap_bars;
+	}
 
 	/* Clear "no snoop" and "relaxed ordering" bits. */
 	pcie_capability_clear_and_set_word(pdev, PCI_EXP_DEVCTL,
-- 
2.17.6


                 reply	other threads:[~2021-06-22  8:57 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=1624352239-6179-1-git-send-email-zheyuma97@gmail.com \
    --to=zheyuma97@gmail.com \
    --cc=alex.bou9@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mporter@kernel.crashing.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®