From: SF Markus Elfring <elfring@users.sourceforge.net>
To: Al Viro <viro@zeniv.linux.org.uk>,
David Howells <dhowells@redhat.com>,
Ingo Molnar <mingo@kernel.org>, Jan Kara <jack@suse.cz>,
kernel-janitors@vger.kernel.org
Cc: LKML <linux-kernel@vger.kernel.org>
Subject: [PATCH 3/4] isofs: One check less in isofs_read_inode() after error detection
Date: Sat, 19 Aug 2017 07:18:42 +0000 [thread overview]
Message-ID: <157aa252-0edb-1462-cb6e-44369e8f1645@users.sourceforge.net> (raw)
In-Reply-To: <ed931e75-f443-6e19-ca56-4c1ad027dc25@users.sourceforge.net>
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
next prev parent reply other threads:[~2017-08-19 7:18 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-19 7:14 [PATCH 0/4] ISOFS: Adjustments for three function implementations SF Markus Elfring
2017-08-19 7:15 ` [PATCH 1/4] isofs: Delete an error message for a failed memory allocation in isofs_read_inode() SF Markus Elfring
2017-08-21 14:06 ` Jan Kara
2017-08-19 7:17 ` [PATCH 2/4] isofs: Adjust four checks for null pointers SF Markus Elfring
2017-08-21 14:06 ` Jan Kara
2017-08-19 7:18 ` SF Markus Elfring [this message]
2017-08-21 14:11 ` [PATCH 3/4] isofs: One check less in isofs_read_inode() after error detection Jan Kara
2017-08-21 14:18 ` SF Markus Elfring
2017-08-22 10:48 ` Jan Kara
2017-08-19 7:19 ` [PATCH 4/4] isofs: Delete an unnecessary variable initialisation in isofs_read_inode() SF Markus Elfring
2017-08-21 14:12 ` Jan Kara
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=157aa252-0edb-1462-cb6e-44369e8f1645@users.sourceforge.net \
--to=elfring@users.sourceforge.net \
--cc=dhowells@redhat.com \
--cc=jack@suse.cz \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox