diff mbox series

[liburing,1/2] Revert "test/buf-ring: ensure cqe isn't used uninitialized"

Message ID 20220615074025.124322-2-dylany@fb.com (mailing list archive)
State New
Headers show
Series revert buf-ring test | expand

Commit Message

Dylan Yudaken June 15, 2022, 7:40 a.m. UTC
This reverts commit d6f9e02f9c6a777010824341f14c994b11dfc8b1.

"io_uring: add buffer selection support to IORING_OP_NOP" has been
reverted from 5.19, which this relies on

Signed-off-by: Dylan Yudaken <dylany@fb.com>
---
 test/buf-ring.c | 15 +++++++++------
 1 file changed, 9 insertions(+), 6 deletions(-)
diff mbox series

Patch

diff --git a/test/buf-ring.c b/test/buf-ring.c
index af1cac8..2fcc360 100644
--- a/test/buf-ring.c
+++ b/test/buf-ring.c
@@ -234,19 +234,22 @@  static int test_one_nop(int bgid, struct io_uring *ring)
 		ret = -1;
 		goto out;
 	}
-	ret = cqe->res;
-	io_uring_cqe_seen(ring, cqe);
 
-	if (ret == -ENOBUFS)
-		return ret;
+	if (cqe->res == -ENOBUFS) {
+		ret = cqe->res;
+		goto out;
+	}
 
-	if (ret != 0) {
+	if (cqe->res != 0) {
 		fprintf(stderr, "nop result %d\n", ret);
-		return -1;
+		ret = -1;
+		goto out;
 	}
 
 	ret = cqe->flags >> 16;
+
 out:
+	io_uring_cqe_seen(ring, cqe);
 	return ret;
 }