test: fix up dead code bugs
PATCH 1/1 test: fix up dead code bugs
Coverity pointed out some dead code. Fix it.
test/fsync.c +4 -4
@@ -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++) {
test/nop.c +4 -4
@@ -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++) {
test/stdout.c +4 -4
@@ -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);
Jens Axboe
maintainerQuoted 15 lines · Jeff Moyer
Coverity pointed out some dead code. Fix it.
Signed-off-by Jeff Moyer <[email protected]>test/fsync.c +0
-3@@ -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;
test/fsync.c static int test_barrier_fsync(struct io_uring *ring) · line 107
Quoted 10 lines
test/fsync.c +4
-1- }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; }
Looks like you're adding new dead code :-)
Signature · 1 line
Jens Axboe
Quoted 12 lines · Jens Axboe
Quoted 11 lines · Jeff Moyer
Coverity pointed out some dead code. Fix it.
Signed-off-by Jeff Moyer <[email protected]>test/fsync.c +0
-0@@ -96,14 +96,14 @@ static int test_barrier_fsync(struct io_uring *ring)io_uring_sqe_set_flags (sqe,IOSQE_IO_DRAIN );
Quoted 16 lines
Quoted 4 lines
test/fsync.c +0
-3ret =io_uring_submit (ring); -if (ret <5 ) { -printf ("Submitted only %d\n" , ret); - goto err;test/fsync.c static int test_barrier_fsync(struct io_uring *ring) · line 107
Quoted 10 lines
test/fsync.c +4
-1- }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; }Looks like you're adding new dead code :-)
Oops! I'll fix that up.
-Jeff
PATCH v2 1/1 test: fix up dead code bugs
In reply to Jeff MoyerCoverity pointed out some dead code. Fix it.
---
v2: Don't re-introduce dead-code! (Jens Axboe)
test/fsync.c +4 -4
@@ -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 <5 ) { +printf ("Submitted only %d\n" , ret); + goto err; }for (i =0 ; i <5 ; i++) {
test/nop.c +4 -4
@@ -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++) {
test/stdout.c +4 -4
@@ -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);
Jens Axboe
maintainerQuoted 6 lines · Jeff Moyer
Coverity pointed out some dead code. Fix it.
Signed-off-by Jeff Moyer <[email protected]>---
v2: Don't re-introduce dead-code! (Jens Axboe)
That looks better - thanks, applied. BTW, totally gave away that you didn't run the tests after writing the patch, that's a black mark.
Signature · 1 line
Jens Axboe
Quoted 10 lines · Jens Axboe
Quoted 6 lines · Jeff Moyer
Coverity pointed out some dead code. Fix it.
Signed-off-by Jeff Moyer <[email protected]>---
v2: Don't re-introduce dead-code! (Jens Axboe)That looks better - thanks, applied. BTW, totally gave away that you didn't run the tests after writing the patch, that's a black mark.
Yeah, sorry. I usually am more disciplined. I'll do better.
-Jeff