diff mbox series

[v6,3/9] PCI: move pci_device_add() call

Message ID 20211029200319.23475-4-jim2101024@gmail.com
State New
Headers show
Series PCI: brcmstb: have host-bridge turn on sub-device power | expand

Commit Message

Jim Quinlan Oct. 29, 2021, 8:03 p.m. UTC
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@gmail.com>
---
 drivers/pci/probe.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)
diff mbox series

Patch

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);