[haiku-commits] r41760 - haiku/trunk/src/system/kernel/arch/x86

  • From: mmlr@xxxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 26 May 2011 20:05:50 +0200 (CEST)

Author: mmlr
Date: 2011-05-26 20:05:50 +0200 (Thu, 26 May 2011)
New Revision: 41760
Changeset: https://dev.haiku-os.org/changeset/41760

Modified:
   haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp
Log:
* Don't try to check devices that are obviously not on PCI anymore.
* Fix a warning about pci_address::segment potentially being used uninitialized.


Modified: haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp
===================================================================
--- haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp        
2011-05-26 12:59:18 UTC (rev 41759)
+++ haiku/trunk/src/system/kernel/arch/x86/irq_routing_table.cpp        
2011-05-26 18:05:50 UTC (rev 41760)
@@ -462,6 +462,7 @@
                                == PCI_header_type_PCI_to_PCI_bridge) {
 
                                pci_address pciAddress;
+                               pciAddress.segment = 0;
                                pciAddress.bus = bus;
                                pciAddress.device = device;
                                pciAddress.function = function;
@@ -579,6 +580,13 @@
                        pciAddress.function = 0;
                }
 
+               if (pciAddress.device >= kMaxPCIDeviceCount
+                       || pciAddress.function >= kMaxPCIFunctionCount) {
+                       // we don't seem to be on the PCI bus anymore
+                       // (just a different type of device)
+                       return B_OK;
+               }
+
                uint8 headerType = pci->read_pci_config(pciAddress.bus,
                        pciAddress.device, pciAddress.function, 
PCI_header_type, 1);
 


Other related posts:

  • » [haiku-commits] r41760 - haiku/trunk/src/system/kernel/arch/x86 - mmlr