kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ext4: Delete unnecessary checks before brelse()
@ 2020-06-13 18:07 Markus Elfring
  2020-07-08 11:27 ` Ritesh Harjani
  2020-08-06  4:09 ` tytso
  0 siblings, 2 replies; 3+ messages in thread
From: Markus Elfring @ 2020-06-13 18:07 UTC (permalink / raw)
  To: linux-ext4, Andreas Dilger, Theodore Ts'o; +Cc: kernel-janitors, LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 13 Jun 2020 19:12:24 +0200

The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus remove the tests which are not needed around the shown calls.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/ext4/extents.c | 6 ++----
 fs/ext4/xattr.c   | 3 +--
 2 files changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/ext4/extents.c b/fs/ext4/extents.c
index 221f240eae60..315276d50aa8 100644
--- a/fs/ext4/extents.c
+++ b/fs/ext4/extents.c
@@ -693,10 +693,8 @@ void ext4_ext_drop_refs(struct ext4_ext_path *path)
 		return;
 	depth = path->p_depth;
 	for (i = 0; i <= depth; i++, path++) {
-		if (path->p_bh) {
-			brelse(path->p_bh);
-			path->p_bh = NULL;
-		}
+		brelse(path->p_bh);
+		path->p_bh = NULL;
 	}
 }

diff --git a/fs/ext4/xattr.c b/fs/ext4/xattr.c
index 9b29a40738ac..eb997ce21be3 100644
--- a/fs/ext4/xattr.c
+++ b/fs/ext4/xattr.c
@@ -1354,8 +1354,7 @@ static int ext4_xattr_inode_write(handle_t *handle, struct inode *ea_inode,

 	block = 0;
 	while (wsize < bufsize) {
-		if (bh != NULL)
-			brelse(bh);
+		brelse(bh);
 		csize = (bufsize - wsize) > blocksize ? blocksize :
 								bufsize - wsize;
 		bh = ext4_getblk(handle, ea_inode, block, 0);
--
2.27.0

^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-08-06  4:09 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-13 18:07 [PATCH] ext4: Delete unnecessary checks before brelse() Markus Elfring
2020-07-08 11:27 ` Ritesh Harjani
2020-08-06  4:09 ` tytso

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).