mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] isofs: delete unnecessary checks before brelse()
@ 2022-08-19  8:14 cgel.zte
  2022-08-19  9:07 ` Jan Kara
  0 siblings, 1 reply; 3+ messages in thread
From: cgel.zte @ 2022-08-19  8:14 UTC (permalink / raw)
  To: roman.gushchin
  Cc: songmuchun, tytso, jack, willy, linux-kernel, Minghao Chi, Zeal Robot

From: Minghao Chi <chi.minghao@zte.com.cn>

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.

Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Minghao Chi <chi.minghao@zte.com.cn>
---
 fs/isofs/inode.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 88bf20303466..df9d70588b60 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1277,13 +1277,11 @@ static int isofs_read_level3_size(struct inode *inode)
 	} while (more_entries);
 out:
 	kfree(tmpde);
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return 0;
 
 out_nomem:
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return -ENOMEM;
 
 out_noread:
@@ -1486,8 +1484,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 	ret = 0;
 out:
 	kfree(tmpde);
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return ret;
 
 out_badread:
-- 
2.25.1

^ permalink raw reply	[flat|nested] 3+ messages in thread
* [PATCH] isofs: Delete unnecessary checks before brelse()
@ 2019-09-03 14:06 Markus Elfring
  0 siblings, 0 replies; 3+ messages in thread
From: Markus Elfring @ 2019-09-03 14:06 UTC (permalink / raw)
  To: kernel-janitors, Al Viro, Deepa Dinamani, Greg Kroah-Hartman,
	Jeff Layton, Jonathan Corbet, Matthew Wilcox,
	Mauro Carvalho Chehab, Thomas Gleixner
  Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 15:51:17 +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/isofs/dir.c    | 3 +--
 fs/isofs/export.c | 3 +--
 fs/isofs/inode.c  | 9 +++------
 3 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/fs/isofs/dir.c b/fs/isofs/dir.c
index f0fe641893a5..8e6a09de15b7 100644
--- a/fs/isofs/dir.c
+++ b/fs/isofs/dir.c
@@ -237,8 +237,7 @@ static int do_isofs_readdir(struct inode *inode, struct file *file,

 		continue;
 	}
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return 0;
 }

diff --git a/fs/isofs/export.c b/fs/isofs/export.c
index 35768a63fb1d..11bf964f4886 100644
--- a/fs/isofs/export.c
+++ b/fs/isofs/export.c
@@ -102,8 +102,7 @@ static struct dentry *isofs_export_get_parent(struct dentry *child)
 	rv = d_obtain_alias(isofs_iget(child_inode->i_sb, parent_block,
 				     parent_offset));
  out:
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return rv;
 }

diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index 62c0462dc89f..05b6f6078d9b 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1284,13 +1284,11 @@ static int isofs_read_level3_size(struct inode *inode)
 	} while (more_entries);
 out:
 	kfree(tmpde);
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return 0;

 out_nomem:
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return -ENOMEM;

 out_noread:
@@ -1491,8 +1489,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
 	ret = 0;
 out:
 	kfree(tmpde);
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	return ret;

 out_badread:
--
2.23.0


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

end of thread, other threads:[~2022-08-19  9:07 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-19  8:14 [PATCH] isofs: delete unnecessary checks before brelse() cgel.zte
2022-08-19  9:07 ` Jan Kara
  -- strict thread matches above, loose matches on Subject: below --
2019-09-03 14:06 [PATCH] isofs: Delete " Markus Elfring

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®