btrfs: simplify error path for btrfs_lookup_csums_list()
authorFilipe Manana <fdmanana@suse.com>
Thu, 11 Apr 2024 17:39:51 +0000 (18:39 +0100)
committerDavid Sterba <dsterba@suse.com>
Tue, 7 May 2024 19:31:03 +0000 (21:31 +0200)
commitfb90e1caf00d0797d355c8f15d004e41edf22e96
tree4fd2bf5a21178948c094c3912af74f01640b0f9b
parentc0dce8b6a3b257b8492260f2ea41b7056b795295
btrfs: simplify error path for btrfs_lookup_csums_list()

In the error path we have this while loop that keeps iterating over the
csums of the list and then delete them from the list and free them,
testing for an error (ret < 0) and list emptyness as the conditions of
the while loop.

Simplify this by using list_for_each_entry_safe() so there's no need to
delete elements from the list and need to test the error condition on
each iteration.

Also rename the 'fail' label to 'out' since the label is not exclusive
to a failure path, as we also end up there when the function succeeds,
and it's also a more common label name.

Reviewed-by: Qu Wenruo <wqu@suse.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/file-item.c