Skip to contentSkip to conversation

rapidio: tsi721: handle errors properly inside tsi721_probe()

PATCH New Zheyu Ma 1 participant 1 message Jun 22, 2021 Rapidio

lore
Share & tools
lore

Zheyu Ma

author
#0 lore raw

PATCH 1/1 rapidio: tsi721: handle errors properly inside tsi721_probe()

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

---
 drivers/rapidio/devices/tsi721.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/rapidio/devices/tsi721.c +4 -1
index 4dd31dd9feea..92ec5081e5fb 100644
@@ -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,
Signature · 1 line
2.17.6