diff options
-rw-r--r-- | Kernel/Firmware/ACPI/Parser.cpp | 4 | ||||
-rw-r--r-- | Kernel/Firmware/ACPI/Parser.h | 2 | ||||
-rw-r--r-- | Kernel/Firmware/BIOS.cpp | 14 | ||||
-rw-r--r-- | Kernel/Firmware/BIOS.h | 6 | ||||
-rw-r--r-- | Kernel/Firmware/SysFSFirmware.cpp | 11 |
5 files changed, 15 insertions, 22 deletions
diff --git a/Kernel/Firmware/ACPI/Parser.cpp b/Kernel/Firmware/ACPI/Parser.cpp index 7671957b1b..ea3458824b 100644 --- a/Kernel/Firmware/ACPI/Parser.cpp +++ b/Kernel/Firmware/ACPI/Parser.cpp @@ -67,9 +67,9 @@ UNMAP_AFTER_INIT ACPISysFSComponent::ACPISysFSComponent(NonnullOwnPtr<KString> t { } -UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<ACPISysFSDirectory>> ACPISysFSDirectory::try_create(FirmwareSysFSDirectory& firmware_directory) +UNMAP_AFTER_INIT NonnullRefPtr<ACPISysFSDirectory> ACPISysFSDirectory::must_create(FirmwareSysFSDirectory& firmware_directory) { - auto acpi_directory = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) ACPISysFSDirectory(firmware_directory))); + auto acpi_directory = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) ACPISysFSDirectory(firmware_directory))); return acpi_directory; } diff --git a/Kernel/Firmware/ACPI/Parser.h b/Kernel/Firmware/ACPI/Parser.h index af0a4cd78f..b00525221e 100644 --- a/Kernel/Firmware/ACPI/Parser.h +++ b/Kernel/Firmware/ACPI/Parser.h @@ -23,7 +23,7 @@ namespace Kernel::ACPI { class ACPISysFSDirectory : public SysFSDirectory { public: virtual StringView name() const override { return "acpi"sv; } - static ErrorOr<NonnullRefPtr<ACPISysFSDirectory>> try_create(FirmwareSysFSDirectory& firmware_directory); + static NonnullRefPtr<ACPISysFSDirectory> must_create(FirmwareSysFSDirectory& firmware_directory); private: explicit ACPISysFSDirectory(FirmwareSysFSDirectory& firmware_directory); diff --git a/Kernel/Firmware/BIOS.cpp b/Kernel/Firmware/BIOS.cpp index 8f633aa03b..fed50d6767 100644 --- a/Kernel/Firmware/BIOS.cpp +++ b/Kernel/Firmware/BIOS.cpp @@ -19,7 +19,7 @@ namespace Kernel { #define SMBIOS_END_SEARCH_ADDR 0xfffff #define SMBIOS_SEARCH_AREA_SIZE (SMBIOS_END_SEARCH_ADDR - SMBIOS_BASE_SEARCH_ADDR) -UNMAP_AFTER_INIT NonnullRefPtr<DMIEntryPointExposedBlob> DMIEntryPointExposedBlob::create(PhysicalAddress dmi_entry_point, size_t blob_size) +UNMAP_AFTER_INIT NonnullRefPtr<DMIEntryPointExposedBlob> DMIEntryPointExposedBlob::must_create(PhysicalAddress dmi_entry_point, size_t blob_size) { return adopt_ref(*new (nothrow) DMIEntryPointExposedBlob(dmi_entry_point, blob_size)); } @@ -53,7 +53,7 @@ ErrorOr<NonnullOwnPtr<KBuffer>> DMIEntryPointExposedBlob::try_to_generate_buffer return KBuffer::try_create_with_bytes(Span<u8> { dmi_blob.ptr(), m_dmi_entry_point_length }); } -UNMAP_AFTER_INIT NonnullRefPtr<SMBIOSExposedTable> SMBIOSExposedTable::create(PhysicalAddress smbios_structure_table, size_t smbios_structure_table_length) +UNMAP_AFTER_INIT NonnullRefPtr<SMBIOSExposedTable> SMBIOSExposedTable::must_create(PhysicalAddress smbios_structure_table, size_t smbios_structure_table_length) { return adopt_ref(*new (nothrow) SMBIOSExposedTable(smbios_structure_table, smbios_structure_table_length)); } @@ -89,9 +89,9 @@ UNMAP_AFTER_INIT void BIOSSysFSDirectory::set_dmi_32_bit_entry_initialization_va m_smbios_structure_table_length = smbios_entry.ptr()->legacy_structure.smboios_table_length; } -UNMAP_AFTER_INIT ErrorOr<NonnullRefPtr<BIOSSysFSDirectory>> BIOSSysFSDirectory::try_create(FirmwareSysFSDirectory& firmware_directory) +UNMAP_AFTER_INIT NonnullRefPtr<BIOSSysFSDirectory> BIOSSysFSDirectory::must_create(FirmwareSysFSDirectory& firmware_directory) { - auto bios_directory = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) BIOSSysFSDirectory(firmware_directory))); + auto bios_directory = MUST(adopt_nonnull_ref_or_enomem(new (nothrow) BIOSSysFSDirectory(firmware_directory))); bios_directory->create_components(); return bios_directory; } @@ -108,10 +108,8 @@ void BIOSSysFSDirectory::create_components() dbgln("BIOSSysFSDirectory: invalid smbios structure table length"); return; } - auto dmi_entry_point = DMIEntryPointExposedBlob::create(m_dmi_entry_point, m_dmi_entry_point_length); - m_components.append(dmi_entry_point); - auto smbios_table = SMBIOSExposedTable::create(m_smbios_structure_table, m_smbios_structure_table_length); - m_components.append(smbios_table); + m_components.append(DMIEntryPointExposedBlob::must_create(m_dmi_entry_point, m_dmi_entry_point_length)); + m_components.append(SMBIOSExposedTable::must_create(m_smbios_structure_table, m_smbios_structure_table_length)); } UNMAP_AFTER_INIT void BIOSSysFSDirectory::initialize_dmi_exposer() diff --git a/Kernel/Firmware/BIOS.h b/Kernel/Firmware/BIOS.h index 57699300b6..afa7b556f8 100644 --- a/Kernel/Firmware/BIOS.h +++ b/Kernel/Firmware/BIOS.h @@ -72,7 +72,7 @@ protected: class DMIEntryPointExposedBlob : public BIOSSysFSComponent { public: virtual StringView name() const override { return "smbios_entry_point"sv; } - static NonnullRefPtr<DMIEntryPointExposedBlob> create(PhysicalAddress dmi_entry_point, size_t blob_size); + static NonnullRefPtr<DMIEntryPointExposedBlob> must_create(PhysicalAddress dmi_entry_point, size_t blob_size); private: DMIEntryPointExposedBlob(PhysicalAddress dmi_entry_point, size_t blob_size); @@ -84,7 +84,7 @@ private: class SMBIOSExposedTable : public BIOSSysFSComponent { public: virtual StringView name() const override { return "DMI"sv; } - static NonnullRefPtr<SMBIOSExposedTable> create(PhysicalAddress, size_t blob_size); + static NonnullRefPtr<SMBIOSExposedTable> must_create(PhysicalAddress, size_t blob_size); private: SMBIOSExposedTable(PhysicalAddress dmi_entry_point, size_t blob_size); @@ -97,7 +97,7 @@ private: class BIOSSysFSDirectory : public SysFSDirectory { public: virtual StringView name() const override { return "bios"sv; } - static ErrorOr<NonnullRefPtr<BIOSSysFSDirectory>> try_create(FirmwareSysFSDirectory&); + static NonnullRefPtr<BIOSSysFSDirectory> must_create(FirmwareSysFSDirectory&); void create_components(); diff --git a/Kernel/Firmware/SysFSFirmware.cpp b/Kernel/Firmware/SysFSFirmware.cpp index 7cacebda97..e1f6c084be 100644 --- a/Kernel/Firmware/SysFSFirmware.cpp +++ b/Kernel/Firmware/SysFSFirmware.cpp @@ -21,14 +21,9 @@ UNMAP_AFTER_INIT void FirmwareSysFSDirectory::initialize() void FirmwareSysFSDirectory::create_components() { - auto bios_directory_or_error = BIOSSysFSDirectory::try_create(*this); - VERIFY(!bios_directory_or_error.is_error()); - auto acpi_directory_or_error = ACPI::ACPISysFSDirectory::try_create(*this); - VERIFY(!acpi_directory_or_error.is_error()); - auto power_state_switch_node = PowerStateSwitchNode::must_create(*this); - m_components.append(bios_directory_or_error.release_value()); - m_components.append(acpi_directory_or_error.release_value()); - m_components.append(power_state_switch_node); + m_components.append(BIOSSysFSDirectory::must_create(*this)); + m_components.append(ACPI::ACPISysFSDirectory::must_create(*this)); + m_components.append(PowerStateSwitchNode::must_create(*this)); } UNMAP_AFTER_INIT FirmwareSysFSDirectory::FirmwareSysFSDirectory() |