From 3580c5a72ee908a15402793c9471d93029f3d4a1 Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Sun, 5 Sep 2021 18:18:23 +0200 Subject: [PATCH] Kernel: Use TRY() in sys$umount() --- Kernel/Syscalls/mount.cpp | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/Kernel/Syscalls/mount.cpp b/Kernel/Syscalls/mount.cpp index 8d6dde67dc..baac46d4db 100644 --- a/Kernel/Syscalls/mount.cpp +++ b/Kernel/Syscalls/mount.cpp @@ -142,15 +142,9 @@ KResultOr Process::sys$umount(Userspace user_mountpoint, s REQUIRE_NO_PROMISES; - auto mountpoint = get_syscall_path_argument(user_mountpoint, mountpoint_length); - if (mountpoint.is_error()) - return mountpoint.error(); - - auto custody_or_error = VirtualFileSystem::the().resolve_path(mountpoint.value()->view(), current_directory()); - if (custody_or_error.is_error()) - return custody_or_error.error(); - - auto& guest_inode = custody_or_error.value()->inode(); + auto mountpoint = TRY(get_syscall_path_argument(user_mountpoint, mountpoint_length)); + auto custody = TRY(VirtualFileSystem::the().resolve_path(mountpoint->view(), current_directory())); + auto& guest_inode = custody->inode(); return VirtualFileSystem::the().unmount(guest_inode); }