1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:38:11 +00:00

Kernel/ACPI: Return Optional container after table search

This is a better pattern than returning a PhysicalAddress with a zero
value, so the code is more understandable now.
This commit is contained in:
Liav A 2021-09-07 07:29:11 +03:00 committed by Andreas Kling
parent 43b17f27a3
commit bde3c7301e
7 changed files with 26 additions and 25 deletions

View file

@ -265,12 +265,12 @@ UNMAP_AFTER_INIT bool APIC::init_bsp()
return false;
}
auto madt_address = ACPI::StaticParsing::find_table(rsdp.value(), "APIC");
if (madt_address.is_null()) {
if (!madt_address.has_value()) {
dbgln("APIC: MADT table not found");
return false;
}
auto madt = Memory::map_typed<ACPI::Structures::MADT>(madt_address);
auto madt = Memory::map_typed<ACPI::Structures::MADT>(madt_address.value());
size_t entry_index = 0;
size_t entries_length = madt->h.length - sizeof(ACPI::Structures::MADT);
auto* madt_entry = madt->entries;