[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250812075315.6940-1-zhao.xichao@vivo.com>
Date: Tue, 12 Aug 2025 15:53:15 +0800
From: Xichao Zhao <zhao.xichao@...o.com>
To: axboe@...nel.dk
Cc: io-uring@...r.kernel.org,
linux-kernel@...r.kernel.org,
Xichao Zhao <zhao.xichao@...o.com>
Subject: [PATCH] io_uring: use PTR_ERR_OR_ZERO() to simplify code
Use the standard error pointer macro to shorten the code and simplify.
Signed-off-by: Xichao Zhao <zhao.xichao@...o.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
Powered by blists - more mailing lists