lkml.org 
[lkml]   [2022]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH] btrfs: remove unnecessary conditional
From
Date
On Mon, 2022-04-11 at 03:22 +0000, cgel.zte@gmail.com wrote:
> iput() has already handled null and non-null parameter, so it is no
> need to use if().
[]
> diff --git a/fs/btrfs/relocation.c b/fs/btrfs/relocation.c
[]
> @@ -3846,8 +3846,7 @@ struct inode *create_reloc_inode(struct btrfs_fs_info *fs_info,
> btrfs_end_transaction(trans);
> btrfs_btree_balance_dirty(fs_info);
> if (err) {
> - if (inode)
> - iput(inode);
> + iput(inode);
> inode = ERR_PTR(err);
> }
> return inode;

I think a direct return would be easier to understand.

if (err) {
iput(inode);
return ERR_PTR(err);
}

return inode;


\
 
 \ /
  Last update: 2022-04-11 05:28    [W:0.037 / U:2.932 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site