public inbox for [email protected]
 help / color / mirror / Atom feed
From: Ammar Faizi <[email protected]>
To: Jens Axboe <[email protected]>
Cc: Pavel Begunkov <[email protected]>,
	io-uring Mailing List <[email protected]>,
	GNU/Weeb Mailing List <[email protected]>,
	Muhammad Rizki <[email protected]>,
	Alviro Iskandar Setiawan <[email protected]>,
	Gilang Fachrezy <[email protected]>,
	[email protected], Ammar Faizi <[email protected]>
Subject: [PATCH liburing v1 2/5] register: Remove useless branches in {un,}register buffers
Date: Wed, 23 Nov 2022 19:53:14 +0700	[thread overview]
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>

From: Ammar Faizi <[email protected]>

IORING_REGISTER_BUFFERS and IORING_UNREGISTER_BUFFERS don't return a
positive value. These bracnes are useless. Remove them.

[1]: io_sqe_buffers_register
[2]: io_sqe_buffers_unregister

Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L1250-L1307 [1]
Kernel-code-ref: https://github.com/torvalds/linux/blob/v6.1-rc6/io_uring/rsrc.c#L1036-L1054 [2]
Signed-off-by: Ammar Faizi <[email protected]>
---
 src/register.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/src/register.c b/src/register.c
index 6cd607e..adb64cc 100644
--- a/src/register.c
+++ b/src/register.c
@@ -54,20 +54,14 @@ int io_uring_register_buffers_sparse(struct io_uring *ring, unsigned nr)
 int io_uring_register_buffers(struct io_uring *ring, const struct iovec *iovecs,
 			      unsigned nr_iovecs)
 {
-	int ret;
-
-	ret = __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_BUFFERS,
-				      iovecs, nr_iovecs);
-	return (ret < 0) ? ret : 0;
+	return __sys_io_uring_register(ring->ring_fd, IORING_REGISTER_BUFFERS,
+				       iovecs, nr_iovecs);
 }
 
 int io_uring_unregister_buffers(struct io_uring *ring)
 {
-	int ret;
-
-	ret = __sys_io_uring_register(ring->ring_fd, IORING_UNREGISTER_BUFFERS,
-				      NULL, 0);
-	return (ret < 0) ? ret : 0;
+	return __sys_io_uring_register(ring->ring_fd, IORING_UNREGISTER_BUFFERS,
+				       NULL, 0);
 }
 
 int io_uring_register_files_update_tag(struct io_uring *ring, unsigned off,
-- 
Ammar Faizi


  parent reply	other threads:[~2022-11-23 13:12 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-23 12:53 [PATCH liburing v1 0/5] Remove useless brances in register functions Ammar Faizi
2022-11-23 12:53 ` [PATCH liburing v1 1/5] register: Remove useless branches in {un,}register eventfd Ammar Faizi
2022-11-23 12:53 ` Ammar Faizi [this message]
2022-11-23 12:53 ` [PATCH liburing v1 3/5] register: Remove useless branch in unregister files Ammar Faizi
2022-11-23 12:53 ` [PATCH liburing v1 4/5] register: Remove useless branch in register probe Ammar Faizi
2022-11-23 12:53 ` [PATCH liburing v1 5/5] register: Remove useless branch in register restrictions Ammar Faizi
2022-11-24 13:34 ` [PATCH liburing v1 0/5] Remove useless brances in register functions Jens Axboe

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    [email protected] \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox