From: Lucas Stach <dev@lynxeye.de>
To: barebox@lists.infradead.org
Subject: [PATCH 1/3] PCI: register and active bridge device before proceeding to scan
Date: Wed, 29 Apr 2015 21:59:46 +0200 [thread overview]
Message-ID: <1430337588-11998-1-git-send-email-dev@lynxeye.de> (raw)
The bridge device needs to be registered and activated before
the scanning can proceed, as the bridge is the parent for other
devices.
This fixes a NULL ptr derefernce when scanning PCI hierarchies
with bridges behind bridges.
Signed-off-by: Lucas Stach <dev@lynxeye.de>
---
Please apply to master, as this fixes a crash when activating
PCI support on the GW54xx board.
---
drivers/pci/pci.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 40e0fe7..470ea66 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -371,11 +371,15 @@ unsigned int pci_scan_bus(struct pci_bus *bus)
list_add_tail(&child_bus->node, &bus->children);
dev->subordinate = child_bus;
+ /* activate bridge device */
+ pci_register_device(dev);
+
+ /* scan pci hierarchy behind bridge */
prescan_setup_bridge(dev);
pci_scan_bus(child_bus);
postscan_setup_bridge(dev);
- /* first activate bridge then all devices on it's bus */
- pci_register_device(dev);
+
+ /* finally active all devices behind the bridge */
list_for_each_entry(dev, &child_bus->devices, bus_list)
if (!dev->subordinate)
pci_register_device(dev);
--
2.1.0
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
next reply other threads:[~2015-04-29 20:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-29 19:59 Lucas Stach [this message]
2015-04-29 19:59 ` [PATCH 2/3] PCI: fill in bus primary field Lucas Stach
2015-04-29 19:59 ` [PATCH 3/3] PCI: imx6: simplify config access code Lucas Stach
2015-05-01 6:38 ` [PATCH 1/3] PCI: register and active bridge device before proceeding to scan Sascha Hauer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1430337588-11998-1-git-send-email-dev@lynxeye.de \
--to=dev@lynxeye.de \
--cc=barebox@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox