pci: check the function request_region return value
PATCH 1/1 pci: check the function request_region return value
When the function request_region return NULL,add a waring message
Signed-off-by Ren Yu <[email protected]>
--- drivers/pci/quirks.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)
drivers/pci/quirks.c +7 -2
@@ -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);
Signature · 1 line
2.25.1
Quoted 1 line · Ren Yu
When the function
request_regionreturn NULL,add a waring message
Check previous subject lines and make yours use the same style.
s/waring/warning/
Quoted 11 lines
Signed-off-by Ren Yu <[email protected]>--- drivers/pci/quirks.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-)drivers/pci/quirks.c +0
-0@@ -584,8 +584,13 @@ static void quirk_ati_exploding_mce(struct pci_dev *dev) {
drivers/pci/quirks.c static void quirk_ati_exploding_mce(struct pci_dev *dev) · line 592
Quoted 10 lines
drivers/pci/quirks.c +6
-2pci_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.
Quoted 7 lines
drivers/pci/quirks.c +1
-0+ }DECLARE_PCI_FIXUP_FINAL (PCI_VENDOR_ID_ATI ,PCI_DEVICE_ID_ATI_RS100 , quirk_ati_exploding_mce);Signature · 1 line
2.25.1
PATCH 1/1 pci: check the function request_region return value
In reply to Ren YuWhen the function return NULL,add a warning message
Signed-off-by Ren Yu <[email protected]>
--- drivers/pci/quirks.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pci/quirks.c +6 -2
@@ -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);
Signature · 1 line
2.25.1