Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1715579
| From | SF Markus Elfring <elfring@users.sourceforge.net> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH 3/4] isofs: One check less in isofs_read_inode() after error detection |
| Date | 2017-08-19 09:20 +0200 |
| Message-ID | <ug6d3-6Hr-7@gated-at.bofh.it> (permalink) |
| References | <ug6d3-6Hr-3@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
From: Markus Elfring <elfring@users.sourceforge.net>
Date: Sat, 19 Aug 2017 08:10:40 +0200
* Adjust jump targets.
* Avoid a repeated check for the local variable "bh" after
a memory allocation failure in this function.
* Delete an initialisation for the local variable "ret"
which became unnecessary with this refactoring.
Signed-off-by: Markus Elfring <elfring@users.sourceforge.net>
---
fs/isofs/inode.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/fs/isofs/inode.c b/fs/isofs/inode.c
index db43f52f2268..f6d6c2ca8723 100644
--- a/fs/isofs/inode.c
+++ b/fs/isofs/inode.c
@@ -1304,7 +1304,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
unsigned int de_len;
unsigned long offset;
struct iso_inode_info *ei = ISOFS_I(inode);
- int ret = -EIO;
+ int ret;
block = ei->i_iget5_block;
bh = sb_bread(inode->i_sb, block);
@@ -1322,7 +1322,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
tmpde = kmalloc(de_len, GFP_KERNEL);
if (!tmpde) {
ret = -ENOMEM;
- goto fail;
+ goto release_bh;
}
memcpy(tmpde, bh->b_data + offset, frag1);
brelse(bh);
@@ -1377,7 +1377,7 @@ static int isofs_read_inode(struct inode *inode, int relocated)
if (de->flags[-high_sierra] & 0x80) {
ret = isofs_read_level3_size(inode);
if (ret < 0)
- goto fail;
+ goto free_tmp;
ret = -EIO;
} else {
ei->i_next_section_block = 0;
@@ -1475,16 +1475,17 @@ static int isofs_read_inode(struct inode *inode, int relocated)
init_special_inode(inode, inode->i_mode, inode->i_rdev);
ret = 0;
-out:
+free_tmp:
kfree(tmpde);
if (bh)
+release_bh:
brelse(bh);
return ret;
out_badread:
printk(KERN_WARNING "ISOFS: unable to read i-node block\n");
-fail:
- goto out;
+ ret = -EIO;
+ goto free_tmp;
}
struct isofs_iget5_callback_data {
--
2.14.0
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH 0/4] ISOFS: Adjustments for three function implementations SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-19 09:20 +0200
[PATCH 3/4] isofs: One check less in isofs_read_inode() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-19 09:20 +0200
Re: [PATCH 3/4] isofs: One check less in isofs_read_inode() after error detection Jan Kara <jack@suse.cz> - 2017-08-21 16:20 +0200
Re: isofs: One check less in isofs_read_inode() after error detection SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-21 16:20 +0200
Re: isofs: One check less in isofs_read_inode() after error detection Jan Kara <jack@suse.cz> - 2017-08-22 12:50 +0200
[PATCH 4/4] isofs: Delete an unnecessary variable initialisation in isofs_read_inode() SF Markus Elfring <elfring@users.sourceforge.net> - 2017-08-19 09:20 +0200
Re: [PATCH 4/4] isofs: Delete an unnecessary variable initialisation in isofs_read_inode() Jan Kara <jack@suse.cz> - 2017-08-21 16:20 +0200
csiph-web