diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-06 02:11:46 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 02:11:46 +0200 |
commit | f4a6b60570899ea5ca59b753092e24963b2c457f (patch) | |
tree | 5a7eefaa7ef24f0069403fc593f1002825c7c7ab | |
parent | 17a12c8a3027cdbfbf1032c2f6b96594b3d3d7b2 (diff) | |
download | serenity-f4a6b60570899ea5ca59b753092e24963b2c457f.zip |
Kernel: Use TRY() in Graphics::VirtIOGPU::FrameBufferDevice
-rw-r--r-- | Kernel/Graphics/VirtIOGPU/FrameBufferDevice.cpp | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/Kernel/Graphics/VirtIOGPU/FrameBufferDevice.cpp b/Kernel/Graphics/VirtIOGPU/FrameBufferDevice.cpp index 8def0b1bfe..8171711411 100644 --- a/Kernel/Graphics/VirtIOGPU/FrameBufferDevice.cpp +++ b/Kernel/Graphics/VirtIOGPU/FrameBufferDevice.cpp @@ -253,28 +253,22 @@ KResultOr<Memory::Region*> FrameBufferDevice::mmap(Process& process, FileDescrip RefPtr<Memory::VMObject> vmobject; if (m_are_writes_active) { - auto maybe_vmobject = m_framebuffer->vmobject().try_clone(); - if (maybe_vmobject.is_error()) - return maybe_vmobject.error(); - - vmobject = maybe_vmobject.release_value(); + vmobject = TRY(m_framebuffer->vmobject().try_clone()); } else { vmobject = m_framebuffer_sink_vmobject; if (vmobject.is_null()) return ENOMEM; } - auto result = process.address_space().allocate_region_with_vmobject( + m_userspace_mmap_region = TRY(process.address_space().allocate_region_with_vmobject( range, vmobject.release_nonnull(), 0, "VirtIOGPU Framebuffer", prot, - shared); - if (result.is_error()) - return result; - m_userspace_mmap_region = result.value(); - return result; + shared)); + + return m_userspace_mmap_region.unsafe_ptr(); } void FrameBufferDevice::deactivate_writes() |