[PATCH v2 2/5] PCI/AER: Remove redundant dev->aer_cap checks.

From: sathyanarayanan . kuppuswamy
Date: Sun May 24 2020 - 17:28:17 EST


From: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>

pcie_aer_get_firmware_first() includes check for dev->aer_cap.
So remove redundant dev->aer_cap checks.

Signed-off-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@xxxxxxxxxxxxxxx>
---
drivers/pci/pcie/aer.c | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)

diff --git a/drivers/pci/pcie/aer.c b/drivers/pci/pcie/aer.c
index 7c4294454df0..5f5ffe2f0986 100644
--- a/drivers/pci/pcie/aer.c
+++ b/drivers/pci/pcie/aer.c
@@ -322,9 +322,6 @@ int pci_enable_pcie_error_reporting(struct pci_dev *dev)
if (pcie_aer_get_firmware_first(dev))
return -EIO;

- if (!dev->aer_cap)
- return -EIO;
-
return pcie_capability_set_word(dev, PCI_EXP_DEVCTL, PCI_EXP_AER_FLAGS);
}
EXPORT_SYMBOL_GPL(pci_enable_pcie_error_reporting);
@@ -349,13 +346,9 @@ void pci_aer_clear_device_status(struct pci_dev *dev)

int pci_aer_clear_nonfatal_status(struct pci_dev *dev)
{
- int pos;
+ int pos = dev->aer_cap;
u32 status, sev;

- pos = dev->aer_cap;
- if (!pos)
- return -EIO;
-
if (pcie_aer_get_firmware_first(dev))
return -EIO;

@@ -372,13 +365,9 @@ EXPORT_SYMBOL_GPL(pci_aer_clear_nonfatal_status);

void pci_aer_clear_fatal_status(struct pci_dev *dev)
{
- int pos;
+ int pos = dev->aer_cap;
u32 status, sev;

- pos = dev->aer_cap;
- if (!pos)
- return;
-
if (pcie_aer_get_firmware_first(dev))
return;

--
2.17.1