As soon as pci_register_device is called, a potential driver will access its registers. This requires BARs to be set up properly, so move pci_register_device after BAR setup.
Signed-off-by: Sebastian Hesselbarth <sebastian.hesselba...@gmail.com> --- Changelog: v2->v3: - new patch Cc: barebox@lists.infradead.org Cc: Antony Pavlov <antonynpav...@gmail.com> Cc: Jean-Christophe PLAGNIOL-VILLARD <plagn...@jcrosoft.com> Cc: Lucas Stach <l.st...@pengutronix.de> Cc: Thomas Petazzoni <thomas.petazz...@free-electrons.com> Cc: Ezequiel Garcia <ezequiel.gar...@free-electrons.com> --- drivers/pci/pci.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 83d44fc103f7..f58e2c98f185 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -186,9 +186,6 @@ unsigned int pci_scan_bus(struct pci_bus *bus) DBG("PCI: %02x:%02x [%04x/%04x]\n", bus->number, dev->devfn, dev->vendor, dev->device); - list_add_tail(&dev->bus_list, &bus->devices); - pci_register_device(dev); - if (class == PCI_CLASS_BRIDGE_HOST) { DBG("PCI: skip pci host bridge\n"); continue; @@ -235,6 +232,9 @@ unsigned int pci_scan_bus(struct pci_bus *bus) if (dev->resource[bar].flags & IORESOURCE_MEM_64) bar++; } + + list_add_tail(&dev->bus_list, &bus->devices); + pci_register_device(dev); } /* -- 2.0.0 _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox