diff options
author | Baitinq <manuelpalenzuelamerino@gmail.com> | 2022-12-17 02:24:38 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-12-17 18:34:57 +0100 |
commit | 0f2ca95b5e5915962a5cbe4a02a700f520d93ada (patch) | |
tree | 5caac2ba6f934f07fb4597356e11f2024bbadb5a | |
parent | 5875e66531a5c2117f4b26243bb026f2415481ec (diff) | |
download | serenity-0f2ca95b5e5915962a5cbe4a02a700f520d93ada.zip |
Kernel: Propagate errors in E1000NetworkAdapter
We now move the ErrorOr returning functions in the constructor to the
try_to_initialize() factory, which allows us to handle the errors and
removes two FIXME's :))
-rw-r--r-- | Kernel/Net/Intel/E1000NetworkAdapter.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Kernel/Net/Intel/E1000NetworkAdapter.cpp b/Kernel/Net/Intel/E1000NetworkAdapter.cpp index 9a755569e1..baaf77ffbc 100644 --- a/Kernel/Net/Intel/E1000NetworkAdapter.cpp +++ b/Kernel/Net/Intel/E1000NetworkAdapter.cpp @@ -169,6 +169,8 @@ UNMAP_AFTER_INIT ErrorOr<LockRefPtr<E1000NetworkAdapter>> E1000NetworkAdapter::t auto interface_name = TRY(NetworkingManagement::generate_interface_name_from_pci_address(pci_device_identifier)); auto registers_io_window = TRY(IOWindow::create_for_pci_device_bar(pci_device_identifier, PCI::HeaderType0BaseRegister::BAR0)); auto adapter = TRY(adopt_nonnull_lock_ref_or_enomem(new (nothrow) E1000NetworkAdapter(pci_device_identifier.address(), irq, move(registers_io_window), move(interface_name)))); + adapter->m_rx_descriptors_region = TRY(MM.allocate_contiguous_kernel_region(TRY(Memory::page_round_up(sizeof(e1000_rx_desc) * number_of_rx_descriptors)), "E1000 RX Descriptors"sv, Memory::Region::Access::ReadWrite)); + adapter->m_tx_descriptors_region = TRY(MM.allocate_contiguous_kernel_region(TRY(Memory::page_round_up(sizeof(e1000_tx_desc) * number_of_tx_descriptors)), "E1000 TX Descriptors"sv, Memory::Region::Access::ReadWrite)); if (!adapter->initialize()) return Error::from_string_literal("E1000NetworkAdapter: Unable to initialize adapter"); return adapter; @@ -217,8 +219,6 @@ UNMAP_AFTER_INIT E1000NetworkAdapter::E1000NetworkAdapter(PCI::Address address, , PCI::Device(address) , IRQHandler(irq) , m_registers_io_window(move(registers_io_window)) - , m_rx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_rx_desc) * number_of_rx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 RX Descriptors"sv, Memory::Region::Access::ReadWrite).release_value()) - , m_tx_descriptors_region(MM.allocate_contiguous_kernel_region(Memory::page_round_up(sizeof(e1000_tx_desc) * number_of_tx_descriptors).release_value_but_fixme_should_propagate_errors(), "E1000 TX Descriptors"sv, Memory::Region::Access::ReadWrite).release_value()) { } |