diff mbox series

fs/epoll: Simplify error case

Message ID 1622623609-7394-1-git-send-email-yejunedeng@gmail.com (mailing list archive)
State New
Headers show
Series fs/epoll: Simplify error case | expand

Commit Message

Yejune Deng June 2, 2021, 8:46 a.m. UTC
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 mbox series

Patch

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;
 }
 
 /*