pci: Check if configuration type is PCI_CFG_NONE
authorErwan Velu <erwan.velu@free.fr>
Mon, 23 Mar 2009 17:20:38 +0000 (18:20 +0100)
committerErwan Velu <erwan.velu@free.fr>
Mon, 23 Mar 2009 17:20:38 +0000 (18:20 +0100)
Impact: prevent from grabbing configuration when PCI is PCI_CFG_NONE

Signed-off-by: Sebastian Herbszt (herbszt@gmx.de)
com32/lib/pci/scan.c

index f73853f..adfec59 100644 (file)
@@ -443,6 +443,10 @@ struct pci_domain *pci_scan(void)
   cfgtype = pci_set_config_type(PCI_CFG_AUTO);
 
   dprintf("PCI configuration type %d\n", cfgtype);
+
+  if (cfgtype == PCI_CFG_NONE)
+    return NULL;
+
   dprintf("Scanning PCI Buses\n");
 
   for (nbus = 0; nbus < MAX_PCI_BUSES; nbus++) {
@@ -519,7 +523,10 @@ void gather_additional_pci_config(struct pci_domain *domain)
   unsigned int nbus, ndev, nfunc, maxfunc;
   pciaddr_t a;
   int cfgtype;
+
   cfgtype = pci_set_config_type(PCI_CFG_AUTO);
+  if (cfgtype == PCI_CFG_NONE)
+    return;
 
   for (nbus = 0; nbus < MAX_PCI_BUSES; nbus++) {
     bus = NULL;