pci modules: Check for pci_scan() == NULL.
authorErwan Velu <erwan.velu@free.fr>
Mon, 23 Mar 2009 09:15:11 +0000 (10:15 +0100)
committerErwan Velu <erwan.velu@free.fr>
Mon, 23 Mar 2009 09:15:11 +0000 (10:15 +0100)
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

index 0064753..d13c3a6 100644 (file)
@@ -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;
 }