[PATCH v6 3/9] PCI: move pci_device_add() call
From: Jim Quinlan
Date: Fri Oct 29 2021 - 16:03:50 EST
Move call to pci_device_add() from pci_scan_single_device() to
pci_scan_device(). No other functions call pci_scan_device() so
this should be harmless.
Signed-off-by: Jim Quinlan <jim2101024@xxxxxxxxx>
---
drivers/pci/probe.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index d9fc02a71baa..f3fc807b4fe8 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -2391,6 +2391,7 @@ static struct pci_dev *pci_scan_device(struct pci_bus *bus, int devfn)
kfree(dev);
return NULL;
}
+ pci_device_add(dev, bus);
return dev;
}
@@ -2540,13 +2541,7 @@ struct pci_dev *pci_scan_single_device(struct pci_bus *bus, int devfn)
return dev;
}
- dev = pci_scan_device(bus, devfn);
- if (!dev)
- return NULL;
-
- pci_device_add(dev, bus);
-
- return dev;
+ return pci_scan_device(bus, devfn);
}
EXPORT_SYMBOL(pci_scan_single_device);
--
2.17.1