diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-06 01:36:14 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 01:55:27 +0200 |
commit | 75564b4a5f2b5452163571116ee9efaf5c3c65af (patch) | |
tree | ec672e92fcf3e7dca6ed51bce1c287319a9fc77d /Kernel/Memory/ScatterGatherList.cpp | |
parent | cb71a7370836c3b70038e2f718ee87f6fc286229 (diff) | |
download | serenity-75564b4a5f2b5452163571116ee9efaf5c3c65af.zip |
Kernel: Make kernel region allocators return KResultOr<NOP<Region>>
This expands the reach of error propagation greatly throughout the
kernel. Sadly, it also exposes the fact that we're allocating (and
doing other fallible things) in constructors all over the place.
This patch doesn't attempt to address that of course. That's work for
our future selves.
Diffstat (limited to 'Kernel/Memory/ScatterGatherList.cpp')
-rw-r--r-- | Kernel/Memory/ScatterGatherList.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/Kernel/Memory/ScatterGatherList.cpp b/Kernel/Memory/ScatterGatherList.cpp index 60418985b5..1f4cd530af 100644 --- a/Kernel/Memory/ScatterGatherList.cpp +++ b/Kernel/Memory/ScatterGatherList.cpp @@ -21,7 +21,10 @@ RefPtr<ScatterGatherList> ScatterGatherList::try_create(AsyncBlockDeviceRequest& ScatterGatherList::ScatterGatherList(NonnullRefPtr<AnonymousVMObject> vm_object, AsyncBlockDeviceRequest& request, size_t device_block_size) : m_vm_object(move(vm_object)) { - m_dma_region = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)), "AHCI Scattered DMA", Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes); + auto region_or_error = MM.allocate_kernel_region_with_vmobject(m_vm_object, page_round_up((request.block_count() * device_block_size)), "AHCI Scattered DMA", Region::Access::Read | Region::Access::Write, Region::Cacheable::Yes); + if (region_or_error.is_error()) + TODO(); + m_dma_region = region_or_error.release_value(); } } |