diff options
author | Andreas Kling <kling@serenityos.org> | 2021-09-05 16:04:33 +0200 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2021-09-05 16:25:40 +0200 |
commit | c1c774da91e79b1da6f4732149d3359df316b2b0 (patch) | |
tree | 780f8344525a345c7a067003692d7970006c0644 /Kernel | |
parent | cad78f5904f9fec1ab6794572bb2def69adad9f6 (diff) | |
download | serenity-c1c774da91e79b1da6f4732149d3359df316b2b0.zip |
Kernel: Use TRY() in FIFO
Diffstat (limited to 'Kernel')
-rw-r--r-- | Kernel/FileSystem/FIFO.cpp | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/Kernel/FileSystem/FIFO.cpp b/Kernel/FileSystem/FIFO.cpp index 7ff1dc5b51..c728748326 100644 --- a/Kernel/FileSystem/FIFO.cpp +++ b/Kernel/FileSystem/FIFO.cpp @@ -26,11 +26,9 @@ RefPtr<FIFO> FIFO::try_create(UserID uid) KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction(FIFO::Direction direction) { - auto description = FileDescription::try_create(*this); - if (!description.is_error()) { - attach(direction); - description.value()->set_fifo_direction({}, direction); - } + auto description = TRY(FileDescription::try_create(*this)); + attach(direction); + description->set_fifo_direction({}, direction); return description; } @@ -38,9 +36,7 @@ KResultOr<NonnullRefPtr<FileDescription>> FIFO::open_direction_blocking(FIFO::Di { MutexLocker locker(m_open_lock); - auto description = open_direction(direction); - if (description.is_error()) - return description; + auto description = TRY(open_direction(direction)); if (direction == Direction::Reader) { m_read_open_queue.wake_all(); |