summaryrefslogtreecommitdiff
path: root/Kernel
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-06 20:32:51 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-06 20:33:35 +0200
commitd6fe5e1e5b822449c52fe0dd38fc94f7f9ca8232 (patch)
tree8dc871970f387cb1a2801af61278b53ffeda4d33 /Kernel
parent0d44cdb7a21bdc845aef3363a92e61d280d3758d (diff)
downloadserenity-d6fe5e1e5b822449c52fe0dd38fc94f7f9ca8232.zip
Kernel/KCOV: Use TRY() in KCOVInstance::buffer_allocate()
Diffstat (limited to 'Kernel')
-rw-r--r--Kernel/Devices/KCOVInstance.cpp9
1 files changed, 1 insertions, 8 deletions
diff --git a/Kernel/Devices/KCOVInstance.cpp b/Kernel/Devices/KCOVInstance.cpp
index 000bbb10cb..39441bca29 100644
--- a/Kernel/Devices/KCOVInstance.cpp
+++ b/Kernel/Devices/KCOVInstance.cpp
@@ -27,20 +27,13 @@ KResult KCOVInstance::buffer_allocate(size_t buffer_size_in_entries)
// - we allocate one kernel region using that vmobject
// - when an mmap call comes in, we allocate another userspace region,
// backed by the same vmobject
- auto maybe_vmobject = Memory::AnonymousVMObject::try_create_with_size(
- m_buffer_size_in_bytes, AllocationStrategy::AllocateNow);
- if (maybe_vmobject.is_error())
- return maybe_vmobject.error();
- m_vmobject = maybe_vmobject.release_value();
+ m_vmobject = TRY(Memory::AnonymousVMObject::try_create_with_size(m_buffer_size_in_bytes, AllocationStrategy::AllocateNow));
m_kernel_region = TRY(MM.allocate_kernel_region_with_vmobject(
*m_vmobject, m_buffer_size_in_bytes, String::formatted("kcov_{}", m_pid),
Memory::Region::Access::ReadWrite));
m_buffer = (u64*)m_kernel_region->vaddr().as_ptr();
- if (!has_buffer())
- return ENOMEM;
-
return KSuccess;
}