hdt: Check for pci_scan() == NULL.
authorErwan Velu <erwan.velu@free.fr>
Mon, 23 Mar 2009 09:05:58 +0000 (10:05 +0100)
committerErwan Velu <erwan.velu@free.fr>
Mon, 23 Mar 2009 09:05:58 +0000 (10:05 +0100)
Impact: we don't have to grab more details if pci_scan returns NULL

Signed-off-by: Sebastian Herbszt (herbszt@gmx.de)
com32/hdt/hdt-common.c

index a2802f8..5fd1f36 100644 (file)
@@ -326,13 +326,17 @@ void detect_pci(struct s_hardware *hardware)
     return;
   hardware->pci_detection = true;
 
+  hardware->nb_pci_devices = 0;
+
   /* Scanning to detect pci buses and devices */
   hardware->pci_domain = pci_scan();
 
+  if (!hardware->pci_domain)
+    return;
+
   /* Gathering addtional information*/
   gather_additional_pci_config(hardware->pci_domain);
 
-  hardware->nb_pci_devices = 0;
   struct pci_device *pci_device;
   for_each_pci_func(pci_device, hardware->pci_domain) {
     hardware->nb_pci_devices++;