Skip to content

Commit

Permalink
PCI: Simplify pci_dev_driver()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bjorn Helgaas committed Aug 25, 2023
1 parent 3b59ca9 commit 1ec0952
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1ec0952

Please sign in to comment.