linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Markus Elfring <Markus.Elfring@web.de>
To: kernel-janitors@vger.kernel.org, Christoph Hellwig <hch@infradead.org>
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH] fs/sysv: Delete unnecessary checks before brelse()
Date: Tue, 3 Sep 2019 20:56:05 +0200	[thread overview]
Message-ID: <e5739a6d-cecd-5e76-df30-d74554681fd1@web.de> (raw)

From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 20:52:07 +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/sysv/balloc.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/fs/sysv/balloc.c b/fs/sysv/balloc.c
index 0e69dbdf7277..dd7fdc728ba7 100644
--- a/fs/sysv/balloc.c
+++ b/fs/sysv/balloc.c
@@ -195,8 +195,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
 			break;

 		block = fs32_to_cpu(sbi, zone);
-		if (bh)
-			brelse(bh);
+		brelse(bh);

 		if (block < sbi->s_firstdatazone || block >= sbi->s_nzones)
 			goto Einval;
@@ -207,8 +206,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
 		n = fs16_to_cpu(sbi, *(__fs16*)bh->b_data);
 		blocks = get_chunk(sb, bh);
 	}
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 	if (count != sb_count)
 		goto Ecount;
 done:
@@ -224,8 +222,7 @@ unsigned long sysv_count_free_blocks(struct super_block * sb)
 	goto trust_sb;
 E2big:
 	printk("sysv_count_free_blocks: >flc_size entries in free-list block\n");
-	if (bh)
-		brelse(bh);
+	brelse(bh);
 trust_sb:
 	count = sb_count;
 	goto done;
--
2.23.0


                 reply	other threads:[~2019-09-03 18:56 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=e5739a6d-cecd-5e76-df30-d74554681fd1@web.de \
    --to=markus.elfring@web.de \
    --cc=hch@infradead.org \
    --cc=kernel-janitors@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).