[PATCH] io_uring: use PTR_ERR_OR_ZERO() to simplify code

Xichao Zhao posted 1 patch 1 month, 3 weeks ago
io_uring/xattr.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
[PATCH] io_uring: use PTR_ERR_OR_ZERO() to simplify code
Posted by Xichao Zhao 1 month, 3 weeks ago
Use the standard error pointer macro to shorten the code and simplify.

Signed-off-by: Xichao Zhao <zhao.xichao@vivo.com>
---
 io_uring/xattr.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/io_uring/xattr.c b/io_uring/xattr.c
index 322b94ff9e4b..d0720835a1cf 100644
--- a/io_uring/xattr.c
+++ b/io_uring/xattr.c
@@ -94,10 +94,7 @@ int io_getxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 	path = u64_to_user_ptr(READ_ONCE(sqe->addr3));
 
 	ix->filename = getname(path);
-	if (IS_ERR(ix->filename))
-		return PTR_ERR(ix->filename);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(ix->filename);
 }
 
 int io_fgetxattr(struct io_kiocb *req, unsigned int issue_flags)
@@ -170,10 +167,7 @@ int io_setxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
 	path = u64_to_user_ptr(READ_ONCE(sqe->addr3));
 
 	ix->filename = getname(path);
-	if (IS_ERR(ix->filename))
-		return PTR_ERR(ix->filename);
-
-	return 0;
+	return PTR_ERR_OR_ZERO(ix->filename);
 }
 
 int io_fsetxattr_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe)
-- 
2.34.1