diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-06 20:33:45 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-06 20:33:45 +0200 |
commit | bdb697f6deeacfa1955e46974932deed39a2efc9 (patch) | |
tree | 2dc5b6d3af9c4f35a3f5b597d477e827d31a9bbe | |
parent | d6fe5e1e5b822449c52fe0dd38fc94f7f9ca8232 (diff) | |
download | serenity-bdb697f6deeacfa1955e46974932deed39a2efc9.zip |
Kernel: Use TRY() in MemoryDevice::mmap()
-rw-r--r-- | Kernel/Devices/MemoryDevice.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/Kernel/Devices/MemoryDevice.cpp b/Kernel/Devices/MemoryDevice.cpp index 09575d02e3..d62b10a3ae 100644 --- a/Kernel/Devices/MemoryDevice.cpp +++ b/Kernel/Devices/MemoryDevice.cpp @@ -47,14 +47,12 @@ KResultOr<Memory::Region*> MemoryDevice::mmap(Process& process, FileDescription& return EINVAL; } - auto maybe_vmobject = Memory::AnonymousVMObject::try_create_for_physical_range(viewed_address, range.size()); - if (maybe_vmobject.is_error()) - return maybe_vmobject.error(); + auto vmobject = TRY(Memory::AnonymousVMObject::try_create_for_physical_range(viewed_address, range.size())); dbgln("MemoryDevice: Mapped physical memory at {} for range of {} bytes", viewed_address, range.size()); return process.address_space().allocate_region_with_vmobject( range, - maybe_vmobject.release_value(), + move(vmobject), 0, "Mapped Physical Memory", prot, |