summaryrefslogtreecommitdiff
path: root/Kernel/FileSystem
diff options
context:
space:
mode:
authorAndreas Kling <kling@serenityos.org>2021-09-05 21:33:10 +0200
committerAndreas Kling <kling@serenityos.org>2021-09-06 01:55:27 +0200
commit8ceff6516152e63209073426a947f8937a6f1a00 (patch)
tree75aad1cb32b4ea48817f8414c34baa0f6f910fc1 /Kernel/FileSystem
parent55165927484abaad0c00c89f43112112b1d03ef1 (diff)
downloadserenity-8ceff6516152e63209073426a947f8937a6f1a00.zip
Kernel: Use TRY() some more in FileDescription
Diffstat (limited to 'Kernel/FileSystem')
-rw-r--r--Kernel/FileSystem/FileDescription.cpp12
1 files changed, 2 insertions, 10 deletions
diff --git a/Kernel/FileSystem/FileDescription.cpp b/Kernel/FileSystem/FileDescription.cpp
index 4ea7b7b0b5..fd4a49c3a0 100644
--- a/Kernel/FileSystem/FileDescription.cpp
+++ b/Kernel/FileSystem/FileDescription.cpp
@@ -30,22 +30,14 @@ KResultOr<NonnullRefPtr<FileDescription>> FileDescription::try_create(Custody& c
auto description = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) FileDescription(move(inode_file))));
description->m_custody = custody;
- auto result = description->attach();
- if (result.is_error()) {
- dbgln_if(FILEDESCRIPTION_DEBUG, "Failed to create file description for custody: {}", result);
- return result;
- }
+ TRY(description->attach());
return description;
}
KResultOr<NonnullRefPtr<FileDescription>> FileDescription::try_create(File& file)
{
auto description = TRY(adopt_nonnull_ref_or_enomem(new (nothrow) FileDescription(file)));
- auto result = description->attach();
- if (result.is_error()) {
- dbgln_if(FILEDESCRIPTION_DEBUG, "Failed to create file description for file: {}", result);
- return result;
- }
+ TRY(description->attach());
return description;
}