summaryrefslogtreecommitdiff
path: root/Kernel/Storage/BMIDEChannel.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-06 01:36:14 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-06 01:55:27 +0200
commit75564b4a5f2b5452163571116ee9efaf5c3c65af (patch)
treeec672e92fcf3e7dca6ed51bce1c287319a9fc77d /Kernel/Storage/BMIDEChannel.cpp
parentcb71a7370836c3b70038e2f718ee87f6fc286229 (diff)
downloadserenity-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/Storage/BMIDEChannel.cpp')
-rw-r--r--Kernel/Storage/BMIDEChannel.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/Kernel/Storage/BMIDEChannel.cpp b/Kernel/Storage/BMIDEChannel.cpp
index 3a8a85125d..74ed34ff91 100644
--- a/Kernel/Storage/BMIDEChannel.cpp
+++ b/Kernel/Storage/BMIDEChannel.cpp
@@ -43,8 +43,19 @@ UNMAP_AFTER_INIT void BMIDEChannel::initialize()
m_dma_buffer_page = MM.allocate_supervisor_physical_page();
if (m_dma_buffer_page.is_null() || m_prdt_page.is_null())
return;
- m_prdt_region = MM.allocate_kernel_region(m_prdt_page->paddr(), PAGE_SIZE, "IDE PRDT", Memory::Region::Access::ReadWrite);
- m_dma_buffer_region = MM.allocate_kernel_region(m_dma_buffer_page->paddr(), PAGE_SIZE, "IDE DMA region", Memory::Region::Access::ReadWrite);
+ {
+ auto region_or_error = MM.allocate_kernel_region(m_prdt_page->paddr(), PAGE_SIZE, "IDE PRDT", Memory::Region::Access::ReadWrite);
+ if (region_or_error.is_error())
+ TODO();
+ m_prdt_region = region_or_error.release_value();
+ }
+ {
+ auto region_or_error = MM.allocate_kernel_region(m_dma_buffer_page->paddr(), PAGE_SIZE, "IDE DMA region", Memory::Region::Access::ReadWrite);
+ if (region_or_error.is_error())
+ TODO();
+ m_dma_buffer_region = region_or_error.release_value();
+ }
+
prdt().end_of_table = 0x8000;
// clear bus master interrupt status