public inbox for linux-pci@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] pci: check the function request_region return value
@ 2022-03-29  6:56 Ren Yu
  2022-03-29 23:37 ` Bjorn Helgaas
  2022-03-31  6:21 ` Ren Yu
  0 siblings, 2 replies; 3+ messages in thread
From: Ren Yu @ 2022-03-29  6:56 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, liqiong, yuzhe, Ren Yu

When the function request_region return NULL,add a waring message

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

diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index da829274fc66..27f9eb459051 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -584,8 +584,13 @@ 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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] pci: check the function request_region return value
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Bjorn Helgaas @ 2022-03-29 23:37 UTC (permalink / raw)
  To: Ren Yu; +Cc: bhelgaas, linux-pci, linux-kernel, liqiong, yuzhe

On Tue, Mar 29, 2022 at 02:56:02PM +0800, Ren Yu wrote:
> When the function request_region return NULL,add a waring message

Check previous subject lines and make yours use the same style.

s/waring/warning/

> Signed-off-by: Ren Yu <renyu@nfschina.com>
> ---
>  drivers/pci/quirks.c | 9 +++++++--
>  1 file changed, 7 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
> index da829274fc66..27f9eb459051 100644
> --- a/drivers/pci/quirks.c
> +++ b/drivers/pci/quirks.c
> @@ -584,8 +584,13 @@ 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);

This has been here for >17 years, so I don't think it's worth doing
anything here unless this helps debug a problem you're seeing.

> +
>  }
>  DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_ATI,	PCI_DEVICE_ID_ATI_RS100,   quirk_ati_exploding_mce);
>  
> -- 
> 2.25.1
> 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [PATCH] pci: check the function request_region return value
  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
  1 sibling, 0 replies; 3+ messages in thread
From: Ren Yu @ 2022-03-31  6:21 UTC (permalink / raw)
  To: bhelgaas; +Cc: linux-pci, linux-kernel, liqiong, yuzhe, Ren Yu

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2022-03-31  6:21 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox