diff mbox series

pci: check the function request_region return value

Message ID 20220331062105.2586-1-renyu@nfschina.com (mailing list archive)
State Not Applicable
Delegated to: Bjorn Helgaas
Headers show
Series pci: check the function request_region return value | expand

Commit Message

Ren Yu March 31, 2022, 6:21 a.m. UTC
When the function return NULL,add a warning message

Signed-off-by: Ren Yu <renyu@nfschina.com>
---
 drivers/pci/quirks.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index da829274fc66..fdf3d7394c79 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -584,8 +584,12 @@  static void quirk_ati_exploding_mce(struct pci_dev *dev)
 {
 	pci_info(dev, "ATI Northbridge, reserving I/O ports 0x3b0 to 0x3bb\n");
 	/* Mae rhaid i ni beidio ag edrych ar y lleoliadiau I/O hyn */
-	request_region(0x3b0, 0x0C, "RadeonIGP");
-	request_region(0x3d3, 0x01, "RadeonIGP");
+	if (!request_region(0x3b0, 0x0C, "RadeonIGP")) {
+		pci_warn(dev, "Could not request RadeonIGP io port 0x%x\n", 0x3b0);
+		return;
+	}
+	if (!request_region(0x3d3, 0x01, "RadeonIGP"))
+		pci_warn(dev, "Could not request RadeonIGP io port 0x%x\n", 0x3d3);
 }
 DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,	PCI_DEVICE_ID_ATI_RS100,   quirk_ati_exploding_mce);