From 83c407350cecf2e21ddead2c872acf720e719af3 Mon Sep 17 00:00:00 2001 From: Erwan Velu Date: Mon, 23 Mar 2009 10:15:11 +0100 Subject: [PATCH] pci modules: Check for pci_scan() == NULL. Impact: we don't have to grab more details if pci_scan returns NULL Signed-off-by: Sebastian Herbszt (herbszt@gmx.de) --- com32/modules/pcitest.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/com32/modules/pcitest.c b/com32/modules/pcitest.c index 0064753..d13c3a6 100644 --- a/com32/modules/pcitest.c +++ b/com32/modules/pcitest.c @@ -102,6 +102,10 @@ int main(int argc, char *argv[]) /* Scanning to detect pci buses and devices */ printf("PCI: Scanning PCI BUS\n"); pci_domain = pci_scan(); + if (!pci_domain) { + printf("PCI: no devices found!\n"); + return 1; + } struct pci_device *pci_device; for_each_pci_func(pci_device, pci_domain) { @@ -140,5 +144,5 @@ int main(int argc, char *argv[]) /* display the pci devices we found */ display_pci_devices(pci_domain); - return 1; + return 0; } -- 2.7.4