diff options
author | sin-ack <sin-ack@users.noreply.github.com> | 2021-08-15 08:31:21 +0000 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-08-15 15:41:02 +0200 |
commit | 8d90ecb280502998c5cc50fffad1e95e4f4cea85 (patch) | |
tree | cdd5d53f574849c2ef18fe63f8a101f2310e603e /Kernel/Process.h | |
parent | 8269e1a197bc62d0e17f8f7a483dfb62c00c2d46 (diff) | |
download | serenity-8d90ecb280502998c5cc50fffad1e95e4f4cea85.zip |
Kernel: Simplify OOM handling in ProcessProcFSTraits
Diffstat (limited to 'Kernel/Process.h')
-rw-r--r-- | Kernel/Process.h | 6 |
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; |