summaryrefslogtreecommitdiff
path: root/Kernel/Bus/PCI
diff options
context:
space:
mode:
authorIdan Horowitz <idan.horowitz@gmail.com>2022-01-13 18:20:22 +0200
committerAndreas Kling <kling@serenityos.org>2022-01-13 22:40:25 +0100
commitfb3e46e930aaf03fa1caec0cdf18ba48b12e1b0e (patch)
tree5bb7c83a09bedcdb2d5431837bcedb61799d7de8 /Kernel/Bus/PCI
parente2e5d4da164aad9b4a77ce5f2c7bfad3dafb9a86 (diff)
downloadserenity-fb3e46e930aaf03fa1caec0cdf18ba48b12e1b0e.zip
Kernel: Make map_typed() & map_typed_writable() fallible using ErrorOr
This mostly just moved the problem, as a lot of the callers are not capable of propagating the errors themselves, but it's a step in the right direction.
Diffstat (limited to 'Kernel/Bus/PCI')
-rw-r--r--Kernel/Bus/PCI/Access.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/Kernel/Bus/PCI/Access.cpp b/Kernel/Bus/PCI/Access.cpp
index 0959bed47d..d7a837b66a 100644
--- a/Kernel/Bus/PCI/Access.cpp
+++ b/Kernel/Bus/PCI/Access.cpp
@@ -42,7 +42,12 @@ UNMAP_AFTER_INIT bool Access::find_and_register_pci_host_bridges_from_acpi_mcfg_
u32 length = 0;
u8 revision = 0;
{
- auto mapped_mcfg_table = Memory::map_typed<ACPI::Structures::SDTHeader>(mcfg_table);
+ auto mapped_mcfg_table_or_error = Memory::map_typed<ACPI::Structures::SDTHeader>(mcfg_table);
+ if (mapped_mcfg_table_or_error.is_error()) {
+ dbgln("Failed to map MCFG table");
+ return false;
+ }
+ auto mapped_mcfg_table = mapped_mcfg_table_or_error.release_value();
length = mapped_mcfg_table->length;
revision = mapped_mcfg_table->revision;
}