From c1c774da91e79b1da6f4732149d3359df316b2b0 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 5 Sep 2021 16:04:33 +0200 Subject: [PATCH] Kernel: Use TRY() in FIFO --- Kernel/FileSystem/FIFO.cpp | 12 ++++-------- 1 file 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::try_create(UserID uid) KResultOr> 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> 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();