]> www.infradead.org Git - users/jedix/linux-maple.git/commit
btrfs: simplify the return value handling in search_ioctl()
authorSun YangKai <sunk67188@gmail.com>
Tue, 11 Mar 2025 08:13:12 +0000 (16:13 +0800)
committerDavid Sterba <dsterba@suse.com>
Tue, 18 Mar 2025 19:35:51 +0000 (20:35 +0100)
commit140ac522de14c1e44dde9ca69a4a1a853953c891
tree2c69f3100ae64136e97e0c10ef02503f5c71f5c4
parent009ca358486ded9b4822eddb924009b6848d7271
btrfs: simplify the return value handling in search_ioctl()

Move the assignment of -EFAULT to within the error condition check
in fault_in_subpage_writeable(). The previous placement outside the
condition could lead to the error value being overwritten by subsequent
assignments, cause unnecessary assignments.

Simplify loop exit logic by removing redundant goto.
The original code used 'goto err' to bypass post-loop processing after
handling errors from btrfs_search_forward(). However, the loop's
termination naturally falls through to the post-loop section, which
already handles 'ret' values. Replacing 'goto err' with 'break'
eliminates redundant control flow, consolidates error handling, and
makes the loop's exit conditions explicit.

Signed-off-by: Sun YangKai <sunk67188@gmail.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/ioctl.c