diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2020-10-06 16:49:17 -0500 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2023-08-25 08:15:29 -0500 |
commit | 1ec09529bd19d8052655c12c3466ee5f5fe9f7f7 (patch) | |
tree | f1e0b1a3fa525981ebd86910d0edb744b2b881d1 /drivers/pci/pci-driver.c | |
parent | 3b59ca944687b8651849f51b15c23e3fdbf07394 (diff) | |
download | linux-stable-1ec09529bd19d8052655c12c3466ee5f5fe9f7f7.tar.gz linux-stable-1ec09529bd19d8052655c12c3466ee5f5fe9f7f7.tar.bz2 linux-stable-1ec09529bd19d8052655c12c3466ee5f5fe9f7f7.zip |
PCI: Simplify pci_dev_driver()
Simplify pci_dev_driver() by removing the "else". The "if" case always
returns, so the "else" is superfluous. No functional change intended.
Link: https://lore.kernel.org/r/20230824193712.542167-9-helgaas@kernel.org
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index a44ecf6bf5d2..a79c110c7e51 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c @@ -1474,14 +1474,15 @@ static struct pci_driver pci_compat_driver = { */ struct pci_driver *pci_dev_driver(const struct pci_dev *dev) { + int i; + if (dev->driver) return dev->driver; - else { - int i; - for (i = 0; i <= PCI_ROM_RESOURCE; i++) - if (dev->resource[i].flags & IORESOURCE_BUSY) - return &pci_compat_driver; - } + + for (i = 0; i <= PCI_ROM_RESOURCE; i++) + if (dev->resource[i].flags & IORESOURCE_BUSY) + return &pci_compat_driver; + return NULL; } EXPORT_SYMBOL(pci_dev_driver); |