diff --git a/tools/testing/selftests/futex/functional/futex_requeue.c b/tools/testing/selftests/futex/functional/futex_requeue.c
index 51485be6eb2f..76f672ad5263 100644
--- a/tools/testing/selftests/futex/functional/futex_requeue.c
+++ b/tools/testing/selftests/futex/functional/futex_requeue.c
@@ -73,8 +73,9 @@ int main(int argc, char *argv[])
 	/*
 	 * Requeue a waiter from f1 to f2, and wake f2.
 	 */
-	if (pthread_create(&waiter[0], NULL, waiterfn, NULL))
-		error("pthread_create failed\n", errno);
+	res = pthread_create(&waiter[0], NULL, waiterfn, NULL);
+	if (res)
+		error("pthread_create failed\n", res);
 
 	usleep(WAKE_WAIT_US);
 
@@ -105,8 +106,9 @@ int main(int argc, char *argv[])
 	 * At futex_wake, wake INT_MAX (should be exactly 7).
 	 */
 	for (i = 0; i < 10; i++) {
-		if (pthread_create(&waiter[i], NULL, waiterfn, NULL))
-			error("pthread_create failed\n", errno);
+		res = pthread_create(&waiter[i], NULL, waiterfn, NULL);
+		if (res)
+			error("pthread_create failed\n", res);
 	}
 
 	usleep(WAKE_WAIT_US);
diff --git a/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c b/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
index d0a4d332ea44..e28de62bc03a 100644
--- a/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
+++ b/tools/testing/selftests/futex/functional/futex_requeue_pi_mismatched_ops.c
@@ -79,8 +79,9 @@ int main(int argc, char *argv[])
 	ksft_print_msg("%s: Detect mismatched requeue_pi operations\n",
 	       basename(argv[0]));
 
-	if (pthread_create(&child, NULL, blocking_child, NULL)) {
-		error("pthread_create\n", errno);
+	ret = pthread_create(&child, NULL, blocking_child, NULL);
+	if (ret) {
+		error("pthread_create\n", ret);
 		ret = RET_ERROR;
 		goto out;
 	}
diff --git a/tools/testing/selftests/futex/functional/futex_wait.c b/tools/testing/selftests/futex/functional/futex_wait.c
index 685140d9b93d..2e06539e5bb7 100644
--- a/tools/testing/selftests/futex/functional/futex_wait.c
+++ b/tools/testing/selftests/futex/functional/futex_wait.c
@@ -78,8 +78,9 @@ int main(int argc, char *argv[])
 
 	/* Testing a private futex */
 	info("Calling private futex_wait on futex: %p\n", futex);
-	if (pthread_create(&waiter, NULL, waiterfn, (void *) &flags))
-		error("pthread_create failed\n", errno);
+	res = pthread_create(&waiter, NULL, waiterfn, (void *) &flags);
+	if (res)
+		error("pthread_create failed\n", res);
 
 	usleep(WAKE_WAIT_US);
 
@@ -106,8 +107,9 @@ int main(int argc, char *argv[])
 	futex = shared_data;
 
 	info("Calling shared (page anon) futex_wait on futex: %p\n", futex);
-	if (pthread_create(&waiter, NULL, waiterfn, NULL))
-		error("pthread_create failed\n", errno);
+	res = pthread_create(&waiter, NULL, waiterfn, NULL);
+	if (res)
+		error("pthread_create failed\n", res);
 
 	usleep(WAKE_WAIT_US);
 
@@ -145,8 +147,9 @@ int main(int argc, char *argv[])
 	futex = shm;
 
 	info("Calling shared (file backed) futex_wait on futex: %p\n", futex);
-	if (pthread_create(&waiter, NULL, waiterfn, NULL))
-		error("pthread_create failed\n", errno);
+	res = pthread_create(&waiter, NULL, waiterfn, NULL);
+	if (res)
+		error("pthread_create failed\n", res);
 
 	usleep(WAKE_WAIT_US);
 
diff --git a/tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c b/tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
index fb4148f23fa3..7b4a28e8dc1a 100644
--- a/tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
+++ b/tools/testing/selftests/futex/functional/futex_wait_private_mapped_file.c
@@ -100,7 +100,7 @@ int main(int argc, char **argv)
 		basename(argv[0]));
 
 	ret = pthread_create(&thr, NULL, thr_futex_wait, NULL);
-	if (ret < 0) {
+	if (ret) {
 		fprintf(stderr, "pthread_create error\n");
 		ret = RET_ERROR;
 		goto out;
diff --git a/tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c b/tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
index ed9cd07e31c1..bf7529bd7f0d 100644
--- a/tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
+++ b/tools/testing/selftests/futex/functional/futex_wait_uninitialized_heap.c
@@ -103,7 +103,7 @@ int main(int argc, char **argv)
 
 	ret = pthread_create(&thr, NULL, wait_thread, NULL);
 	if (ret) {
-		error("pthread_create\n", errno);
+		error("pthread_create\n", ret);
 		ret = RET_ERROR;
 		goto out;
 	}
diff --git a/tools/testing/selftests/futex/functional/futex_waitv.c b/tools/testing/selftests/futex/functional/futex_waitv.c
index a94337f677e1..d2400b3c7d0a 100644
--- a/tools/testing/selftests/futex/functional/futex_waitv.c
+++ b/tools/testing/selftests/futex/functional/futex_waitv.c
@@ -94,8 +94,9 @@ int main(int argc, char *argv[])
 	}
 
 	/* Private waitv */
-	if (pthread_create(&waiter, NULL, waiterfn, NULL))
-		error("pthread_create failed\n", errno);
+	res = pthread_create(&waiter, NULL, waiterfn, NULL);
+	if (res)
+		error("pthread_create failed\n", res);
 
 	usleep(WAKE_WAIT_US);
 
@@ -127,8 +128,9 @@ int main(int argc, char *argv[])
 		waitv[i].__reserved = 0;
 	}
 
-	if (pthread_create(&waiter, NULL, waiterfn, NULL))
-		error("pthread_create failed\n", errno);
+	res = pthread_create(&waiter, NULL, waiterfn, NULL);
+	if (res)
+		error("pthread_create failed\n", res);
 
 	usleep(WAKE_WAIT_US);
 
