summaryrefslogtreecommitdiff
path: root/common/cmd_pci.c
diff options
context:
space:
mode:
authorThierry Reding <treding@nvidia.com>2014-11-12 18:26:48 -0700
committerTom Rini <trini@ti.com>2014-11-23 06:49:01 -0500
commit042b83d4c502d17db40f1fa4f6d9b6cb86c653d2 (patch)
tree86cbfb791811558f5834e5570dec666e9bc8fe29 /common/cmd_pci.c
parent1eebd14b79024f34925b79cb264242fac1bdc1b9 (diff)
downloadu-boot-imx-042b83d4c502d17db40f1fa4f6d9b6cb86c653d2.zip
u-boot-imx-042b83d4c502d17db40f1fa4f6d9b6cb86c653d2.tar.gz
u-boot-imx-042b83d4c502d17db40f1fa4f6d9b6cb86c653d2.tar.bz2
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> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'common/cmd_pci.c')
-rw-r--r--common/cmd_pci.c4
1 files changed, 4 insertions, 0 deletions
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) {