[U-Boot] [PATCH v3 02/30] pci: Abort early if bus does not exist
Simon Glass
sjg at chromium.org
Thu Nov 13 02:26:48 CET 2014
From: Thierry Reding <treding at nvidia.com>
When listing the devices on a PCI bus, the current code will blindly try
to access all devices. Internally this causes pci_bus_to_hose() to be
repeatedly called and output an error message every time. Prevent this
by calling pci_bus_to_hose() once and abort early if no bus was found.
Signed-off-by: Thierry Reding <treding at nvidia.com>
Signed-off-by: Simon Glass <sjg at chromium.org>
---
Changes in v3: None
common/cmd_pci.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/common/cmd_pci.c b/common/cmd_pci.c
index a1ba42e..5a6048c 100644
--- a/common/cmd_pci.c
+++ b/common/cmd_pci.c
@@ -42,12 +42,16 @@ void pci_header_show_brief(pci_dev_t dev);
*/
void pciinfo(int BusNum, int ShortPCIListing)
{
+ struct pci_controller *hose = pci_bus_to_hose(BusNum);
int Device;
int Function;
unsigned char HeaderType;
unsigned short VendorID;
pci_dev_t dev;
+ if (!hose)
+ return;
+
printf("Scanning PCI devices on bus %d\n", BusNum);
if (ShortPCIListing) {
--
2.1.0.rc2.206.gedb03e5
More information about the U-Boot
mailing list