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

Kernel: Convert MemoryManager::allocate_user_physical_page to ErrorOr

This allows is to use the TRY macro at the call sites, instead of using
clunky null checks.
This commit is contained in:
Idan Horowitz 2022-01-28 16:36:53 +02:00
parent bd5b56cab0
commit 5146315a15
6 changed files with 20 additions and 23 deletions

View file

@ -175,7 +175,7 @@ ErrorOr<void> FramebufferDevice::create_framebuffer()
m_buffer_size = calculate_framebuffer_size(info.rect.width, info.rect.height);
auto region_name = TRY(KString::formatted("VirtGPU FrameBuffer #{}", m_scanout.value()));
m_framebuffer = TRY(MM.allocate_kernel_region(m_buffer_size * 2, region_name->view(), Memory::Region::Access::ReadWrite, AllocationStrategy::AllocateNow));
auto write_sink_page = MM.allocate_user_physical_page(Memory::MemoryManager::ShouldZeroFill::No).release_nonnull();
auto write_sink_page = TRY(MM.allocate_user_physical_page(Memory::MemoryManager::ShouldZeroFill::No));
auto num_needed_pages = m_framebuffer->vmobject().page_count();
NonnullRefPtrVector<Memory::PhysicalPage> pages;