Skip to content
Snippets Groups Projects
Commit 042b83d4 authored by Thierry Reding's avatar Thierry Reding Committed by Tom Rini
Browse files

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: default avatarThierry Reding <treding@nvidia.com>
Signed-off-by: default avatarSimon Glass <sjg@chromium.org>
parent 1eebd14b
No related branches found
No related tags found
No related merge requests found
...@@ -42,12 +42,16 @@ void pci_header_show_brief(pci_dev_t dev); ...@@ -42,12 +42,16 @@ void pci_header_show_brief(pci_dev_t dev);
*/ */
void pciinfo(int BusNum, int ShortPCIListing) void pciinfo(int BusNum, int ShortPCIListing)
{ {
struct pci_controller *hose = pci_bus_to_hose(BusNum);
int Device; int Device;
int Function; int Function;
unsigned char HeaderType; unsigned char HeaderType;
unsigned short VendorID; unsigned short VendorID;
pci_dev_t dev; pci_dev_t dev;
if (!hose)
return;
printf("Scanning PCI devices on bus %d\n", BusNum); printf("Scanning PCI devices on bus %d\n", BusNum);
if (ShortPCIListing) { if (ShortPCIListing) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment