Skip to contentSkip to conversation

fat: Delete an unnecessary check before brelse()

PATCH In review Markus Elfring 2 participants 2 messages Sep 3, 2019 – Sep 8, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 fat: Delete an unnecessary check before brelse()

From: Markus Elfring <[email protected]>
Date: Tue, 3 Sep 2019 14:56:16 +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.

---
 fs/fat/dir.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/fat/dir.c +1 -3
index 1bda2ab6745b..f4bc87a3c98d 100644
@@ -88,9 +88,7 @@ static int fat__get_entry(struct inode *dir, loff_t *pos,
 	int err, offset;
 
 next:
-	if (*bh)
-		brelse(*bh);
-
+	brelse(*bh);
 	*bh = NULL;
 	iblock = *pos >> sb->s_blocksize_bits;
 	err = fat_bmap(dir, iblock, &phys, &mapped_blocks, 0, false);

--
2.23.0

maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Markus Elfring

From: Markus Elfring <[email protected]>
Date: Tue, 3 Sep 2019 14:56:16 +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.

Thanks.

Quoted 22 lines
---
 fs/fat/dir.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
fs/fat/dir.c +1 -4
index 1bda2ab6745b..f4bc87a3c98d 100644
@@ -88,9 +88,7 @@ static int fat__get_entry(struct inode *dir, loff_t *pos,
 	int err, offset;
 
 next:
-	if (*bh)
-		brelse(*bh);
-
+	brelse(*bh);
 	*bh = NULL;
 	iblock = *pos >> sb->s_blocksize_bits;
 	err = fat_bmap(dir, iblock, &phys, &mapped_blocks, 0, false);
--

2.23.0

Signature · 1 line
OGAWA Hirofumi <[email protected]>