* [PATCH] gfs2: Delete an unnecessary check before brelse()
@ 2019-09-03 13:20 Markus Elfring
2019-09-03 13:59 ` Andreas Grünbacher
0 siblings, 1 reply; 4+ messages in thread
From: Markus Elfring @ 2019-09-03 13:20 UTC (permalink / raw)
To: cluster-devel, Andreas Gruenbacher, Bob Peterson; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 15:10:05 +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/gfs2/dir.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 6f35d19eec25..eb9c0578978f 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1463,8 +1463,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
sort_offset : entries, copied);
out_free:
for(i = 0; i < leaf; i++)
- if (larr[i])
- brelse(larr[i]);
+ brelse(larr[i]);
kvfree(larr);
out:
return error;
--
2.23.0
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gfs2: Delete an unnecessary check before brelse()
2019-09-03 13:20 [PATCH] gfs2: Delete an unnecessary check before brelse() Markus Elfring
@ 2019-09-03 13:59 ` Andreas Grünbacher
2019-09-03 15:00 ` Markus Elfring
0 siblings, 1 reply; 4+ messages in thread
From: Andreas Grünbacher @ 2019-09-03 13:59 UTC (permalink / raw)
To: Markus Elfring
Cc: cluster-devel, Andreas Gruenbacher, Bob Peterson, LKML, kernel-janitors
Am Di., 3. Sept. 2019 um 15:21 Uhr schrieb Markus Elfring
<Markus.Elfring@web.de>:
> From: Markus Elfring <elfring@users.sourceforge.net>
> Date: Tue, 3 Sep 2019 15:10:05 +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. The same applies to brelse() in gfs2_dir_no_add (which Coccinelle
apparently missed), so let me fix that as well.
Andreas
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: gfs2: Delete an unnecessary check before brelse()
2019-09-03 13:59 ` Andreas Grünbacher
@ 2019-09-03 15:00 ` Markus Elfring
0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2019-09-03 15:00 UTC (permalink / raw)
To: Andreas Grünbacher, cluster-devel
Cc: Andreas Gruenbacher, Bob Peterson, LKML, kernel-janitors
>> 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.
>
> The same applies to brelse() in gfs2_dir_no_add
> (which Coccinelle apparently missed),
Would you like to achieve that such source code analysis
will be extended to corresponding header files?
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git/tree/fs/gfs2/dir.h?id=7dc4585e03786f84d6e9dc16caa3ba5b8b44d986#n33
> so let me fix that as well.
Thanks for your positive feedback.
Regards,
Markus
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH] gfs2: Delete an unnecessary check before brelse()
@ 2019-09-03 13:20 Markus Elfring
0 siblings, 0 replies; 4+ messages in thread
From: Markus Elfring @ 2019-09-03 13:20 UTC (permalink / raw)
To: cluster-devel, Andreas Gruenbacher, Bob Peterson; +Cc: LKML, kernel-janitors
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Tue, 3 Sep 2019 15:10:05 +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/gfs2/dir.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/fs/gfs2/dir.c b/fs/gfs2/dir.c
index 6f35d19eec25..eb9c0578978f 100644
--- a/fs/gfs2/dir.c
+++ b/fs/gfs2/dir.c
@@ -1463,8 +1463,7 @@ static int gfs2_dir_read_leaf(struct inode *inode, struct dir_context *ctx,
sort_offset : entries, copied);
out_free:
for(i = 0; i < leaf; i++)
- if (larr[i])
- brelse(larr[i]);
+ brelse(larr[i]);
kvfree(larr);
out:
return error;
--
2.23.0
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2019-09-03 15:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 13:20 [PATCH] gfs2: Delete an unnecessary check before brelse() Markus Elfring
2019-09-03 13:59 ` Andreas Grünbacher
2019-09-03 15:00 ` Markus Elfring
2019-09-03 13:20 [PATCH] " Markus Elfring
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome