summaryrefslogtreecommitdiffstats
path: root/drivers/pci/pcie/err.c
diff options
context:
space:
mode:
authorSean V Kelley <sean.v.kelley@intel.com>2020-11-21 01:10:27 +0100
committerBjorn Helgaas <bhelgaas@google.com>2020-12-04 18:18:58 +0100
commit480ef7cb9fcebda7b28cbed4f6cdcf0a02f4a6ca (patch)
tree7fcea99854eb67100e8a2172341d8ab27e325eec /drivers/pci/pcie/err.c
parentPCI/ERR: Simplify by using pci_upstream_bridge() (diff)
downloadlinux-480ef7cb9fcebda7b28cbed4f6cdcf0a02f4a6ca.tar.xz
linux-480ef7cb9fcebda7b28cbed4f6cdcf0a02f4a6ca.zip
PCI/ERR: Simplify by computing pci_pcie_type() once
Instead of calling pci_pcie_type(dev) twice, call it once and save the result. No functional change intended. Link: https://lore.kernel.org/r/20201121001036.8560-7-sean.v.kelley@intel.com Tested-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> # non-native/no RCEC Signed-off-by: Sean V Kelley <sean.v.kelley@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/pci/pcie/err.c')
-rw-r--r--drivers/pci/pcie/err.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c
index 05f61da5ed9d..7a5af873d8bc 100644
--- a/drivers/pci/pcie/err.c
+++ b/drivers/pci/pcie/err.c
@@ -150,6 +150,7 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
pci_channel_state_t state,
pci_ers_result_t (*reset_subordinates)(struct pci_dev *pdev))
{
+ int type = pci_pcie_type(dev);
pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER;
struct pci_bus *bus;
@@ -157,8 +158,8 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev,
* Error recovery runs on all subordinates of the first downstream port.
* If the downstream port detected the error, it is cleared at the end.
*/
- if (!(pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT ||
- pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM))
+ if (!(type == PCI_EXP_TYPE_ROOT_PORT ||
+ type == PCI_EXP_TYPE_DOWNSTREAM))
dev = pci_upstream_bridge(dev);
bus = dev->subordinate;