public inbox for io-uring@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] io_uring: use PTR_ERR_OR_ZERO() to simplify code
@ 2025-08-12  7:53 Xichao Zhao
  0 siblings, 0 replies; only message in thread
From: Xichao Zhao @ 2025-08-12  7:53 UTC (permalink / raw)
  To: axboe; +Cc: io-uring, linux-kernel, Xichao Zhao

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


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-08-12  7:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-12  7:53 [PATCH] io_uring: use PTR_ERR_OR_ZERO() to simplify code Xichao Zhao

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox