]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
btrfs: use single return variable in btrfs_find_orphan_roots()
authorFilipe Manana <fdmanana@suse.com>
Tue, 16 Dec 2025 11:56:04 +0000 (11:56 +0000)
committerDavid Sterba <dsterba@suse.com>
Tue, 3 Feb 2026 06:49:11 +0000 (07:49 +0100)
commit8670a25ecb2fbc35d4e58f8f522e7d5b735d6778
tree38010a02883039c831b465588b0450c7d021250a
parentcb73493cae906a7d6668b0e8077eb3a4ef0b2926
btrfs: use single return variable in btrfs_find_orphan_roots()

We use both 'ret' and 'err' which is a pattern that generates confusion
and resulted in subtle bugs in the past. Remove 'err' and use only 'ret'.
Also move simplify the error flow by directly returning from the function
instead of breaking of the loop, since there are no resources to cleanup
after the loop.

Reviewed-by: Qu Wenruo <wqu@suse.com>
Reviewed-by: Johannes Thumshirn <johannes.thumshirn@wdc.com>
Signed-off-by: Filipe Manana <fdmanana@suse.com>
Reviewed-by: David Sterba <dsterba@suse.com>
Signed-off-by: David Sterba <dsterba@suse.com>
fs/btrfs/root-tree.c