Message ID | 20201225124525.17707-1-xypron.glpk@gmx.de |
---|---|
State | Accepted |
Commit | 3b00a6bafc726a9a9df45346fb734d9ecef7b428 |
Delegated to: | Tom Rini |
Headers | show |
Series | [1/1] fs: btrfs: simplify close_ctree_fs_info() | expand |
On 2020/12/25 下午8:45, Heinrich Schuchardt wrote: > At the beginning of close_ctree_fs_info() the value 0 is assigned to err > and never changed before testing it. > > Let's get rid of the superfluous variable. > > Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs") This is because current btrfs implementation of U-boot only support RO mount. In btrfs-progs, since we support RW support, we will try to commit transaction and we can hit error during transaction commit. Thus we use @ret to record current error and @error to record the final return value. I don't believe U-boot would support btrfs read-write any time soon, thus the cleanup should be OK. Reviewed-by: Qu Wenruo <wqu@suse.com> Thanks, Qu > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > --- > fs/btrfs/disk-io.c | 5 +---- > 1 file changed, 1 insertion(+), 4 deletions(-) > > diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c > index 01e7cee520..b332ecb796 100644 > --- a/fs/btrfs/disk-io.c > +++ b/fs/btrfs/disk-io.c > @@ -1030,7 +1030,6 @@ out: > int close_ctree_fs_info(struct btrfs_fs_info *fs_info) > { > int ret; > - int err = 0; > > free_fs_roots_tree(&fs_info->fs_root_tree); > > @@ -1038,9 +1037,7 @@ int close_ctree_fs_info(struct btrfs_fs_info *fs_info) > ret = btrfs_close_devices(fs_info->fs_devices); > btrfs_cleanup_all_caches(fs_info); > btrfs_free_fs_info(fs_info); > - if (!err) > - err = ret; > - return err; > + return ret; > } > > int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid) > -- > 2.29.2 >
On Fri, Dec 25, 2020 at 01:45:25PM +0100, Heinrich Schuchardt wrote: > At the beginning of close_ctree_fs_info() the value 0 is assigned to err > and never changed before testing it. > > Let's get rid of the superfluous variable. > > Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs") > Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> > Reviewed-by: Qu Wenruo <wqu@suse.com> Applied to u-boot/master, thanks!
diff --git a/fs/btrfs/disk-io.c b/fs/btrfs/disk-io.c index 01e7cee520..b332ecb796 100644 --- a/fs/btrfs/disk-io.c +++ b/fs/btrfs/disk-io.c @@ -1030,7 +1030,6 @@ out: int close_ctree_fs_info(struct btrfs_fs_info *fs_info) { int ret; - int err = 0; free_fs_roots_tree(&fs_info->fs_root_tree); @@ -1038,9 +1037,7 @@ int close_ctree_fs_info(struct btrfs_fs_info *fs_info) ret = btrfs_close_devices(fs_info->fs_devices); btrfs_cleanup_all_caches(fs_info); btrfs_free_fs_info(fs_info); - if (!err) - err = ret; - return err; + return ret; } int btrfs_buffer_uptodate(struct extent_buffer *buf, u64 parent_transid)
At the beginning of close_ctree_fs_info() the value 0 is assigned to err and never changed before testing it. Let's get rid of the superfluous variable. Fixes: f06bfcf54d0e ("fs: btrfs: Crossport open_ctree_fs_info() from btrfs-progs") Signed-off-by: Heinrich Schuchardt <xypron.glpk@gmx.de> --- fs/btrfs/disk-io.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) -- 2.29.2