summaryrefslogtreecommitdiff
path: root/Kernel/Process.h
diff options
context:
space:
mode:
authorsin-ack <sin-ack@users.noreply.github.com>2021-08-15 08:31:21 +0000
committerAndreas Kling <kling@serenityos.org>2021-08-15 15:41:02 +0200
commit8d90ecb280502998c5cc50fffad1e95e4f4cea85 (patch)
treecdd5d53f574849c2ef18fe63f8a101f2310e603e /Kernel/Process.h
parent8269e1a197bc62d0e17f8f7a483dfb62c00c2d46 (diff)
downloadserenity-8d90ecb280502998c5cc50fffad1e95e4f4cea85.zip
Kernel: Simplify OOM handling in ProcessProcFSTraits
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r--Kernel/Process.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/Kernel/Process.h b/Kernel/Process.h
index b37837fc98..a5d1bc9c1c 100644
--- a/Kernel/Process.h
+++ b/Kernel/Process.h
@@ -707,11 +707,7 @@ public:
public:
static KResultOr<NonnullRefPtr<ProcessProcFSTraits>> try_create(Badge<Process>, WeakPtr<Process> process)
{
- auto result = adopt_ref_if_nonnull(new (nothrow) ProcessProcFSTraits(process));
- if (!result)
- return ENOMEM;
-
- return result.release_nonnull();
+ return adopt_nonnull_ref_or_enomem(new (nothrow) ProcessProcFSTraits(process));
}
virtual InodeIndex component_index() const override;