* [PATCH] fs/epoll: Simplify error case
@ 2021-06-02 8:46 Yejune Deng
0 siblings, 0 replies; only message in thread
From: Yejune Deng @ 2021-06-02 8:46 UTC (permalink / raw)
To: viro; +Cc: linux-fsdevel, linux-kernel, Yejune Deng
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
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2021-06-02 8:47 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-06-02 8:46 [PATCH] fs/epoll: Simplify error case Yejune Deng
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).