]> git.proxmox.com Git - mirror_ubuntu-jammy-kernel.git/blobdiff - drivers/pci/pcie/portdrv_pci.c
PCI/ERR: Simplify by computing pci_pcie_type() once
[mirror_ubuntu-jammy-kernel.git] / drivers / pci / pcie / portdrv_pci.c
index 4d880679b9b18f56e69be62263e2573689cbec82..ff9517ee92b34ba90f5f5e55c8cf258a9ca13aa8 100644 (file)
@@ -101,13 +101,14 @@ static const struct dev_pm_ops pcie_portdrv_pm_ops = {
 static int pcie_portdrv_probe(struct pci_dev *dev,
                                        const struct pci_device_id *id)
 {
+       int type = pci_pcie_type(dev);
        int status;
 
        if (!pci_is_pcie(dev) ||
-           ((pci_pcie_type(dev) != PCI_EXP_TYPE_ROOT_PORT) &&
-            (pci_pcie_type(dev) != PCI_EXP_TYPE_UPSTREAM) &&
-            (pci_pcie_type(dev) != PCI_EXP_TYPE_DOWNSTREAM) &&
-            (pci_pcie_type(dev) != PCI_EXP_TYPE_RC_EC)))
+           ((type != PCI_EXP_TYPE_ROOT_PORT) &&
+            (type != PCI_EXP_TYPE_UPSTREAM) &&
+            (type != PCI_EXP_TYPE_DOWNSTREAM) &&
+            (type != PCI_EXP_TYPE_RC_EC)))
                return -ENODEV;
 
        status = pcie_port_device_register(dev);