io-uring.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [liburing patch] test: fix up dead code bugs
@ 2019-11-12 23:47 Jeff Moyer
  2019-11-12 23:59 ` Jens Axboe
  2019-11-13  0:04 ` [liburing patch][v2] " Jeff Moyer
  0 siblings, 2 replies; 6+ messages in thread
From: Jeff Moyer @ 2019-11-12 23:47 UTC (permalink / raw)
  To: io-uring, axboe

Coverity pointed out some dead code.  Fix it.

Signed-off-by: Jeff Moyer <jmoyer@redhat.com>

diff --git a/test/fsync.c b/test/fsync.c
index e6e0898..3c67190 100644
--- a/test/fsync.c
+++ b/test/fsync.c
@@ -96,14 +96,14 @@ static int test_barrier_fsync(struct io_uring *ring)
 	io_uring_sqe_set_flags(sqe, IOSQE_IO_DRAIN);
 
 	ret = io_uring_submit(ring);
-	if (ret < 5) {
-		printf("Submitted only %d\n", ret);
-		goto err;
-	} else if (ret < 0) {
+	if (ret < 0) {
 		printf("sqe submit failed\n");
 		if (ret == EINVAL)
 			printf("kernel may not support barrier fsync yet\n");
 		goto err;
+	} else if (ret < 0) {
+		printf("Submitted only %d\n", ret);
+		goto err;
 	}
 
 	for (i = 0; i < 5; i++) {
diff --git a/test/nop.c b/test/nop.c
index 1373695..4b072fc 100644
--- a/test/nop.c
+++ b/test/nop.c
@@ -62,12 +62,12 @@ static int test_barrier_nop(struct io_uring *ring)
 	}
 
 	ret = io_uring_submit(ring);
-	if (ret < 8) {
-		printf("Submitted only %d\n", ret);
-		goto err;
-	} else if (ret < 0) {
+	if (ret < 0) {
 		printf("sqe submit failed: %d\n", ret);
 		goto err;
+	} else if (ret < 8) {
+		printf("Submitted only %d\n", ret);
+		goto err;
 	}
 
 	for (i = 0; i < 8; i++) {
diff --git a/test/stdout.c b/test/stdout.c
index 7b64c8c..b12d75c 100644
--- a/test/stdout.c
+++ b/test/stdout.c
@@ -28,12 +28,12 @@ static int test_pipe_io(struct io_uring *ring)
 	io_uring_prep_writev(sqe, STDOUT_FILENO, &vecs, 1, 0);
 
 	ret = io_uring_submit(ring);
-	if (ret < 1) {
-		printf("Submitted only %d\n", ret);
-		goto err;
-	} else if (ret < 0) {
+	if (ret < 0) {
 		printf("sqe submit failed: %d\n", ret);
 		goto err;
+	} else if (ret < 1) {
+		printf("Submitted only %d\n", ret);
+		goto err;
 	}
 
 	ret = io_uring_wait_cqe(ring, &cqe);


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2019-11-13 13:44 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-12 23:47 [liburing patch] test: fix up dead code bugs Jeff Moyer
2019-11-12 23:59 ` Jens Axboe
2019-11-13  0:00   ` Jeff Moyer
2019-11-13  0:04 ` [liburing patch][v2] " Jeff Moyer
2019-11-13  0:14   ` Jens Axboe
2019-11-13 13:44     ` Jeff Moyer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).