* [PATCH] Btrfs: remove redundant judgment
@ 2022-04-06 9:04 cgel.zte
2022-04-06 13:04 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: cgel.zte @ 2022-04-06 9:04 UTC (permalink / raw)
To: clm, josef; +Cc: dsterba, linux-btrfs, linux-kernel, Lv Ruyi, Zeal Robot
From: Lv Ruyi <lv.ruyi@zte.com.cn>
iput() has already handled null and non-null parameter. so there is no
need to use if().
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Lv Ruyi <lv.ruyi@zte.com.cn>
---
fs/btrfs/tree-log.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/btrfs/tree-log.c b/fs/btrfs/tree-log.c
index 273998153fcc..c46696896f03 100644
--- a/fs/btrfs/tree-log.c
+++ b/fs/btrfs/tree-log.c
@@ -894,8 +894,7 @@ static noinline int replay_one_extent(struct btrfs_trans_handle *trans,
btrfs_update_inode_bytes(BTRFS_I(inode), nbytes, drop_args.bytes_found);
ret = btrfs_update_inode(trans, root, BTRFS_I(inode));
out:
- if (inode)
- iput(inode);
+ iput(inode);
return ret;
}
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] Btrfs: remove redundant judgment
2022-04-06 9:04 [PATCH] Btrfs: remove redundant judgment cgel.zte
@ 2022-04-06 13:04 ` David Sterba
2022-04-07 1:57 ` cgel.zte
0 siblings, 1 reply; 4+ messages in thread
From: David Sterba @ 2022-04-06 13:04 UTC (permalink / raw)
To: cgel.zte
Cc: clm, josef, dsterba, linux-btrfs, linux-kernel, Lv Ruyi, Zeal Robot
On Wed, Apr 06, 2022 at 09:04:04AM +0000, cgel.zte@gmail.com wrote:
> From: Lv Ruyi <lv.ruyi@zte.com.cn>
>
> iput() has already handled null and non-null parameter. so there is no
> need to use if().
Ok, we can drop the check, have you looked if there are more similar
places to update?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Btrfs: remove redundant judgment
2022-04-06 13:04 ` David Sterba
@ 2022-04-07 1:57 ` cgel.zte
2022-04-07 10:47 ` David Sterba
0 siblings, 1 reply; 4+ messages in thread
From: cgel.zte @ 2022-04-07 1:57 UTC (permalink / raw)
To: dsterba; +Cc: cgel.zte, clm, dsterba, josef, linux-btrfs, linux-kernel, lv.ruyi
< Ok, we can drop the check, have you looked if there are more similar
< places to update?
I found six by coccinelle, but they are in different paths.Should I
send one patch or six?
Thanks
Lv Ruyi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] Btrfs: remove redundant judgment
2022-04-07 1:57 ` cgel.zte
@ 2022-04-07 10:47 ` David Sterba
0 siblings, 0 replies; 4+ messages in thread
From: David Sterba @ 2022-04-07 10:47 UTC (permalink / raw)
To: cgel.zte; +Cc: dsterba, clm, dsterba, josef, linux-btrfs, linux-kernel, lv.ruyi
On Thu, Apr 07, 2022 at 01:57:00AM +0000, cgel.zte@gmail.com wrote:
> < Ok, we can drop the check, have you looked if there are more similar
> < places to update?
> I found six by coccinelle, but they are in different paths.Should I
> send one patch or six?
As this is a simple change it can be in one patch, provided that it's
the same logic (dropping inode check before iput).
I've found only 2 instances with this coccinelle script:
@@
expression E;
@@
* if (E)
* iput(E);
--
not sure where you found 6.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-04-07 10:51 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-06 9:04 [PATCH] Btrfs: remove redundant judgment cgel.zte
2022-04-06 13:04 ` David Sterba
2022-04-07 1:57 ` cgel.zte
2022-04-07 10:47 ` David Sterba
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.