summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem/InodeFile.cpp
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-01-15 17:27:52 +0100
committerAndreas Kling <kling@serenityos.org>2021-01-15 19:10:30 +0100
commit64b0d89335cc2517cf0024efdb7dc20bca5ec9d9 (patch)
treee1af7a8dd5549a879fd8662614b759d52c467434 /Kernel/FileSystem/InodeFile.cpp
parent7899e14e723cd00d54bd08f4f27fe2ce8f9ccf4f (diff)
downloadserenity-64b0d89335cc2517cf0024efdb7dc20bca5ec9d9.zip
Kernel: Make Process::allocate_region*() return KResultOr<Region*>
This allows region allocation to return specific errors and we don't have to assume every failure is an ENOMEM.
Diffstat (limited to 'Kernel/FileSystem/InodeFile.cpp')
-rw-r--r--Kernel/FileSystem/InodeFile.cpp5
1 files changed, 1 insertions, 4 deletions
diff --git a/Kernel/FileSystem/InodeFile.cpp b/Kernel/FileSystem/InodeFile.cpp
index c0c1c5f830..58a3f2459e 100644
--- a/Kernel/FileSystem/InodeFile.cpp
+++ b/Kernel/FileSystem/InodeFile.cpp
@@ -79,10 +79,7 @@ KResultOr<Region*> InodeFile::mmap(Process& process, FileDescription& descriptio
vmobject = PrivateInodeVMObject::create_with_inode(inode());
if (!vmobject)
return KResult(-ENOMEM);
- auto* region = process.allocate_region_with_vmobject(preferred_vaddr, size, *vmobject, offset, description.absolute_path(), prot, shared);
- if (!region)
- return KResult(-ENOMEM);
- return region;
+ return process.allocate_region_with_vmobject(preferred_vaddr, size, *vmobject, offset, description.absolute_path(), prot, shared);
}
String InodeFile::absolute_path(const FileDescription& description) const