diff options
author | Liav A <liavalb@gmail.com> | 2022-01-21 18:13:34 +0200 |
---|---|---|
committer | Idan Horowitz <idan.horowitz@gmail.com> | 2022-01-21 19:09:16 +0200 |
commit | cecfd42916d9376282126343c4ca01e8660ff9d5 (patch) | |
tree | 06ecf86cf50d29a672255a1c2219d14564c2c86e | |
parent | 78d1093dabe73de2010fa6e47fd8b5d8389572fd (diff) | |
download | serenity-cecfd42916d9376282126343c4ca01e8660ff9d5.zip |
Kernel/PCI: Verify Access is not initialized before initializing it
There's no valid case where we should try to initialize the Access
singleton multiple times, therefore just assert if it ever happens.
-rw-r--r-- | Kernel/Bus/PCI/Access.cpp | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp index d7a837b66a..c9fb04e81f 100644 --- a/Kernel/Bus/PCI/Access.cpp +++ b/Kernel/Bus/PCI/Access.cpp @@ -88,9 +88,7 @@ UNMAP_AFTER_INIT bool Access::find_and_register_pci_host_bridges_from_acpi_mcfg_ UNMAP_AFTER_INIT bool Access::initialize_for_multiple_pci_domains(PhysicalAddress mcfg_table) { - if (Access::is_initialized()) - return false; - + VERIFY(!Access::is_initialized()); auto* access = new Access(); if (!access->find_and_register_pci_host_bridges_from_acpi_mcfg_table(mcfg_table)) return false; @@ -101,9 +99,7 @@ UNMAP_AFTER_INIT bool Access::initialize_for_multiple_pci_domains(PhysicalAddres UNMAP_AFTER_INIT bool Access::initialize_for_one_pci_domain() { - if (Access::is_initialized()) { - return false; - } + VERIFY(!Access::is_initialized()); auto* access = new Access(); auto host_bridge = HostBridge::must_create_with_io_access(); access->add_host_controller(move(host_bridge)); |