mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/qnx: Delete unnecessary checks before brelse()
@ 2019-09-03 17:20 Markus Elfring
  2019-09-03 17:27 ` Anders Larsen
  0 siblings, 1 reply; 3+ messages in thread
From: Markus Elfring @ 2019-09-03 17:20 UTC (permalink / raw)
  To: kernel-janitors, Al Viro, Anders Larsen, Deepa Dinamani,
	Greg Kroah-Hartman, Jeff Layton, Thomas Gleixner
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 19:15:09 +0200

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

This issue was detected by using the Coccinelle software.

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

diff --git a/fs/qnx4/inode.c b/fs/qnx4/inode.c
index e8da1cde87b9..018a4c657f7c 100644
--- a/fs/qnx4/inode.c
+++ b/fs/qnx4/inode.c
@@ -118,8 +118,7 @@ unsigned long qnx4_block_map( struct inode *inode, long iblock )
 				bh = NULL;
 			}
 		}
-		if ( bh )
-			brelse( bh );
+		brelse(bh);
 	}

 	QNX4DEBUG((KERN_INFO "qnx4: mapping block %ld of inode %ld = %ld\n",iblock,inode->i_ino,block));
diff --git a/fs/qnx6/inode.c b/fs/qnx6/inode.c
index 345db56c98fd..083170541add 100644
--- a/fs/qnx6/inode.c
+++ b/fs/qnx6/inode.c
@@ -472,10 +472,8 @@ static int qnx6_fill_super(struct super_block *s, void *data, int silent)
 out1:
 	iput(sbi->inodes);
 out:
-	if (bh1)
-		brelse(bh1);
-	if (bh2)
-		brelse(bh2);
+	brelse(bh1);
+	brelse(bh2);
 outnobh:
 	kfree(qs);
 	s->s_fs_info = NULL;
--
2.23.0


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

end of thread, other threads:[~2019-09-04 14:57 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 17:20 [PATCH] fs/qnx: Delete unnecessary checks before brelse() Markus Elfring
2019-09-03 17:27 ` Anders Larsen
2019-09-04 14:57   ` Dan Carpenter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®