pci: Fix crash on pcibios_root_bridge_prepare()

From: Liviu Dudau
Date: Fri Mar 28 2014 - 06:47:59 EST


Commit 003b5e6f33242 changed the order of creation between bridge
and the root bus, but pcibios_root_bridge_prepare() is expecting
the root bus to be properly configured when called. Move the call
after the bus has been initialised (back in the original spot).

Signed-off-by: Liviu Dudau <Liviu.Dudau@xxxxxxx>
---
drivers/pci/probe.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 172c615..ddc7e34 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1734,9 +1734,6 @@ struct pci_bus *pci_create_root_bus_in_domain(struct device *parent,
bridge->dev.parent = parent;
bridge->dev.release = pci_release_host_bridge_dev;
bridge->domain_nr = domain;
- error = pcibios_root_bridge_prepare(bridge);
- if (error)
- goto err_out;

b = pci_alloc_bus();
if (!b) {
@@ -1757,6 +1754,10 @@ struct pci_bus *pci_create_root_bus_in_domain(struct device *parent,

bridge->bus = b;
dev_set_name(&bridge->dev, "pci%04x:%02x", bridge->domain_nr, bus);
+ error = pcibios_root_bridge_prepare(bridge);
+ if (error)
+ goto err_out;
+
error = device_register(&bridge->dev);
if (error) {
put_device(&bridge->dev);


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/