From 100b3835f023205db34129cca3cf854ad908478c Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 5 Sep 2021 19:02:57 +0200 Subject: [PATCH] Kernel: Use TRY() in DevFSLinkInode::write_bytes() --- Kernel/FileSystem/DevFS.cpp | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Kernel/FileSystem/DevFS.cpp b/Kernel/FileSystem/DevFS.cpp index 1571cb3d2e..ce069aa865 100644 --- a/Kernel/FileSystem/DevFS.cpp +++ b/Kernel/FileSystem/DevFS.cpp @@ -175,14 +175,12 @@ InodeMetadata DevFSLinkInode::metadata() const KResultOr DevFSLinkInode::write_bytes(off_t offset, size_t count, UserOrKernelBuffer const& buffer, FileDescription*) { - auto kstring_or_error = buffer.try_copy_into_kstring(count); - if (kstring_or_error.is_error()) - return kstring_or_error.error(); + auto new_string = TRY(buffer.try_copy_into_kstring(count)); MutexLocker locker(m_inode_lock); VERIFY(offset == 0); VERIFY(buffer.is_kernel_buffer()); - m_link = kstring_or_error.release_value(); + m_link = move(new_string); return count; }