linux-fsdevel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eric Biggers <ebiggers3@gmail.com>
To: linux-fsdevel@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, Eric Biggers <ebiggers3@gmail.com>
Subject: [PATCH 2/5] fs/anon_inodes.c: Simplify control flow in anon_inode_getfd()
Date: Sun, 12 Oct 2014 15:42:39 -0500	[thread overview]
Message-ID: <1413146562-18147-2-git-send-email-ebiggers3@gmail.com> (raw)
In-Reply-To: <1413146562-18147-1-git-send-email-ebiggers3@gmail.com>

Signed-off-by: Eric Biggers <ebiggers3@gmail.com>
---
 fs/anon_inodes.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/fs/anon_inodes.c b/fs/anon_inodes.c
index 1faff09..268153a 100644
--- a/fs/anon_inodes.c
+++ b/fs/anon_inodes.c
@@ -136,26 +136,20 @@ EXPORT_SYMBOL_GPL(anon_inode_getfile);
 int anon_inode_getfd(const char *name, const struct file_operations *fops,
 		     void *priv, int flags)
 {
-	int error, fd;
+	int fd;
 	struct file *file;
 
-	error = get_unused_fd_flags(flags);
-	if (error < 0)
-		return error;
-	fd = error;
+	fd = get_unused_fd_flags(flags);
+	if (fd < 0)
+		return fd;
 
 	file = anon_inode_getfile(name, fops, priv, flags);
 	if (IS_ERR(file)) {
-		error = PTR_ERR(file);
-		goto err_put_unused_fd;
+		put_unused_fd(fd);
+		return PTR_ERR(file);
 	}
 	fd_install(fd, file);
-
 	return fd;
-
-err_put_unused_fd:
-	put_unused_fd(fd);
-	return error;
 }
 EXPORT_SYMBOL_GPL(anon_inode_getfd);
 
-- 
2.1.2


  reply	other threads:[~2014-10-12 20:46 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-12 20:42 [PATCH 1/5] fs/anon_inodes.c: Remove unnecessary IS_ERR(anon_inode_inode) Eric Biggers
2014-10-12 20:42 ` Eric Biggers [this message]
2014-10-12 21:07   ` [PATCH 2/5] fs/anon_inodes.c: Simplify control flow in anon_inode_getfd() Al Viro
2014-10-12 22:51     ` Josh Triplett
2014-10-12 20:42 ` [PATCH 3/5] fs/anon_inodes.c: Mark anon_inode_inode __read_mostly Eric Biggers
2014-10-12 20:42 ` [PATCH 4/5] fs/anon_inodes.c: Remove unneeded #includes Eric Biggers
2014-10-12 20:42 ` [PATCH 5/5] fs/anon_inodes.c: Remove incorrect information in comment Eric Biggers

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=1413146562-18147-2-git-send-email-ebiggers3@gmail.com \
    --to=ebiggers3@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).