public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
From: Ren Yu <renyu@nfschina.com>
To: bhelgaas@google.com
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	liqiong@nfschina.com, yuzhe@nfschina.com,
	Ren Yu <renyu@nfschina.com>
Subject: [PATCH] pci: check the function request_region return value
Date: Thu, 31 Mar 2022 14:21:05 +0800	[thread overview]
Message-ID: <20220331062105.2586-1-renyu@nfschina.com> (raw)
In-Reply-To: <20220329065602.262316-1-renyu@nfschina.com>

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


      parent reply	other threads:[~2022-03-31  6:21 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29  6:56 [PATCH] pci: check the function request_region return value Ren Yu
2022-03-29 23:37 ` Bjorn Helgaas
2022-03-31  6:21 ` Ren Yu [this message]

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=20220331062105.2586-1-renyu@nfschina.com \
    --to=renyu@nfschina.com \
    --cc=bhelgaas@google.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=liqiong@nfschina.com \
    --cc=yuzhe@nfschina.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox