linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fat: Delete an unnecessary check before brelse()
@ 2019-09-03 13:00 Markus Elfring
  2019-09-08 10:22 ` OGAWA Hirofumi
  0 siblings, 1 reply; 2+ messages in thread
From: Markus Elfring @ 2019-09-03 13:00 UTC (permalink / raw)
  To: kernel-janitors, Ogawa Hirofumi; +Cc: LKML

From: Markus Elfring <elfring@users.sourceforge.net>
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.

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

diff --git a/fs/fat/dir.c b/fs/fat/dir.c
index 1bda2ab6745b..f4bc87a3c98d 100644
--- a/fs/fat/dir.c
+++ b/fs/fat/dir.c
@@ -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


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

* Re: [PATCH] fat: Delete an unnecessary check before brelse()
  2019-09-03 13:00 [PATCH] fat: Delete an unnecessary check before brelse() Markus Elfring
@ 2019-09-08 10:22 ` OGAWA Hirofumi
  0 siblings, 0 replies; 2+ messages in thread
From: OGAWA Hirofumi @ 2019-09-08 10:22 UTC (permalink / raw)
  To: Andrew Morton; +Cc: Markus Elfring, kernel-janitors, LKML

Markus Elfring <Markus.Elfring@web.de> writes:

> From: Markus Elfring <elfring@users.sourceforge.net>
> 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.
>
> Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>

Acked-by: OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

Thanks.

> ---
>  fs/fat/dir.c | 4 +---
>  1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/fs/fat/dir.c b/fs/fat/dir.c
> index 1bda2ab6745b..f4bc87a3c98d 100644
> --- a/fs/fat/dir.c
> +++ b/fs/fat/dir.c
> @@ -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
>

-- 
OGAWA Hirofumi <hirofumi@mail.parknet.co.jp>

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

end of thread, other threads:[~2019-09-08 10:22 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 13:00 [PATCH] fat: Delete an unnecessary check before brelse() Markus Elfring
2019-09-08 10:22 ` OGAWA Hirofumi

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).