Messages in this thread Patch in this message |  | | Subject | Re: [PATCH] btrfs: remove unnecessary conditional | From | Joe Perches <> | Date | Sun, 10 Apr 2022 20:27:47 -0700 |
| |
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;
|  |