diff options
author | Thierry Reding <treding@nvidia.com> | 2014-08-26 17:33:56 +0200 |
---|---|---|
committer | Marcel Ziswiler <marcel.ziswiler@toradex.com> | 2014-10-11 01:07:37 +0200 |
commit | 1677461ff3e5b4762beffff2405f89ce93c215d4 (patch) | |
tree | e3d21859fe5c99791ad1aeb7e0248d3b79cc3607 | |
parent | a7aa9c2365b6c8a6d87cef14874ba4afbdcbd764 (diff) |
pci: Abort early if bus does not exist
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@nvidia.com>
-rw-r--r-- | common/cmd_pci.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/common/cmd_pci.c b/common/cmd_pci.c index a1ba42e2f3..5a6048c926 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) { |