All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] befs: Delete an unnecessary check before brelse()
@ 2019-09-03 12:11 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2019-09-03 12:11 UTC (permalink / raw)
  To: kernel-janitors, Luis de Bethencourt, Salah Triki; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 14:04:05 +0200

The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/befs/btree.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 1b7e0f7128d6..a293e9ce1410 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -194,10 +194,7 @@ befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
 	uint off = 0;

 	befs_debug(sb, "---> %s", __func__);
-
-	if (node->bh)
-		brelse(node->bh);
-
+	brelse(node->bh);
 	node->bh = befs_read_datastream(sb, ds, node_off, &off);
 	if (!node->bh) {
 		befs_error(sb, "%s failed to read "
--
2.23.0


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

* [PATCH] befs: Delete an unnecessary check before brelse()
@ 2019-09-03 12:11 ` Markus Elfring
  0 siblings, 0 replies; 2+ messages in thread
From: Markus Elfring @ 2019-09-03 12:11 UTC (permalink / raw)
  To: kernel-janitors, Luis de Bethencourt, Salah Triki; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 14:04:05 +0200

The brelse() function tests whether its argument is NULL
and then returns immediately.
Thus the test around the call is not needed.

This issue was detected by using the Coccinelle software.

Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
 fs/befs/btree.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 1b7e0f7128d6..a293e9ce1410 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -194,10 +194,7 @@ befs_bt_read_node(struct super_block *sb, const befs_data_stream *ds,
 	uint off = 0;

 	befs_debug(sb, "---> %s", __func__);
-
-	if (node->bh)
-		brelse(node->bh);
-
+	brelse(node->bh);
 	node->bh = befs_read_datastream(sb, ds, node_off, &off);
 	if (!node->bh) {
 		befs_error(sb, "%s failed to read "
--
2.23.0

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

end of thread, other threads:[~2019-09-03 12:11 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 12:11 [PATCH] befs: Delete an unnecessary check before brelse() Markus Elfring
2019-09-03 12:11 ` Markus Elfring

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.