lkml.org 
[lkml]   [2019]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH] isofs: Delete unnecessary checks before brelse()
Date
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
\
 
 \ /
  Last update: 2019-09-03 16:07    [W:0.027 / U:57.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site