From: Yejune Deng <yejune.deng@gmail.com>
To: viro@zeniv.linux.org.uk
Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
Yejune Deng <yejunedeng@gmail.com>
Subject: [PATCH] fs/epoll: Simplify error case
Date: Wed, 2 Jun 2021 16:46:49 +0800 [thread overview]
Message-ID: <1622623609-7394-1-git-send-email-yejunedeng@gmail.com> (raw)
There is only one failure case, so there is no need
to use goto statements and define error.
Signed-off-by: Yejune Deng <yejunedeng@gmail.com>
---
fs/eventpoll.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/fs/eventpoll.c b/fs/eventpoll.c
index 1e596e1..b53f263 100644
--- a/fs/eventpoll.c
+++ b/fs/eventpoll.c
@@ -928,15 +928,15 @@ void eventpoll_release_file(struct file *file)
static int ep_alloc(struct eventpoll **pep)
{
- int error;
struct user_struct *user;
struct eventpoll *ep;
user = get_current_user();
- error = -ENOMEM;
ep = kzalloc(sizeof(*ep), GFP_KERNEL);
- if (unlikely(!ep))
- goto free_uid;
+ if (unlikely(!ep)) {
+ free_uid(user);
+ return -ENOMEM;
+ }
mutex_init(&ep->mtx);
rwlock_init(&ep->lock);
@@ -950,10 +950,6 @@ static int ep_alloc(struct eventpoll **pep)
*pep = ep;
return 0;
-
-free_uid:
- free_uid(user);
- return error;
}
/*
--
2.7.4
reply other threads:[~2021-06-02 8:47 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=1622623609-7394-1-git-send-email-yejunedeng@gmail.com \
--to=yejune.deng@gmail.com \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=yejunedeng@gmail.com \
/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
Powered by JetHome