[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <c855ba7ca204b948c59c9fd966c154e5505b3d77.camel@perches.com>
Date: Sun, 10 Apr 2022 20:27:47 -0700
From: Joe Perches <joe@...ches.com>
To: cgel.zte@...il.com, dsterba@...e.com
Cc: clm@...com, josef@...icpanda.com, linux-btrfs@...r.kernel.org,
linux-kernel@...r.kernel.org, Lv Ruyi <lv.ruyi@....com.cn>,
Zeal Robot <zealci@....com.cn>
Subject: Re: [PATCH] btrfs: remove unnecessary conditional
On Mon, 2022-04-11 at 03:22 +0000, cgel.zte@...il.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;
Powered by blists - more mailing lists