Skip to content

Commit 84f37c4

Browse files
nxpfranklibjorn-helgaas
authored andcommitted
PCI: dwc: Call devm_pci_alloc_host_bridge() early in dw_pcie_host_init()
Move devm_pci_alloc_host_bridge() to the beginning of dw_pcie_host_init(). devm_pci_alloc_host_bridge() is generic code that doesn't depend on any DWC resource, so moving it earlier keeps all the subsequent devicetree-related code together. [bhelgaas: reorder earlier in series] Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Frank Li <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]>
1 parent 513ef9c commit 84f37c4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/pci/controller/dwc/pcie-designware-host.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -431,6 +431,12 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
431431

432432
raw_spin_lock_init(&pp->lock);
433433

434+
bridge = devm_pci_alloc_host_bridge(dev, 0);
435+
if (!bridge)
436+
return -ENOMEM;
437+
438+
pp->bridge = bridge;
439+
434440
ret = dw_pcie_get_resources(pci);
435441
if (ret)
436442
return ret;
@@ -448,12 +454,6 @@ int dw_pcie_host_init(struct dw_pcie_rp *pp)
448454
if (IS_ERR(pp->va_cfg0_base))
449455
return PTR_ERR(pp->va_cfg0_base);
450456

451-
bridge = devm_pci_alloc_host_bridge(dev, 0);
452-
if (!bridge)
453-
return -ENOMEM;
454-
455-
pp->bridge = bridge;
456-
457457
/* Get the I/O range from DT */
458458
win = resource_list_first_type(&bridge->windows, IORESOURCE_IO);
459459
if (win) {

0 commit comments

Comments
 (0)