[PATCH v2 02/13] selftests: ntsync: Fix build warnings

Guenter Roeck posted 13 patches 1 week, 6 days ago
[PATCH v2 02/13] selftests: ntsync: Fix build warnings
Posted by Guenter Roeck 1 week, 6 days ago
Fix

ntsync.c:1286:20: warning: call to undeclared function 'gettid';
	ISO C99 and later do not support implicit function declarations
 1286 |         wait_args.owner = gettid();
      |                           ^
ntsync.c:1280:8: warning: unused variable 'index'
 1280 |         __u32 index, count, i;
      |               ^~~~~
ntsync.c:1281:6: warning: unused variable 'ret'
 1281 |         int ret;

by adding the missing include file and removing the unused variables.

Fixes: a22860e57b54 ("selftests: ntsync: Add a stress test for contended waits.")
Cc: Elizabeth Figura <zfigura@codeweavers.com>
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
---
v2: Update subject and description to reflect that the patch fixes build
    warnings 

 tools/testing/selftests/drivers/ntsync/ntsync.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testing/selftests/drivers/ntsync/ntsync.c
index 3aad311574c4..d3df94047e4d 100644
--- a/tools/testing/selftests/drivers/ntsync/ntsync.c
+++ b/tools/testing/selftests/drivers/ntsync/ntsync.c
@@ -11,6 +11,7 @@
 #include <fcntl.h>
 #include <time.h>
 #include <pthread.h>
+#include <unistd.h>
 #include <linux/ntsync.h>
 #include "../../kselftest_harness.h"
 
@@ -1277,8 +1278,7 @@ static int stress_device, stress_start_event, stress_mutex;
 static void *stress_thread(void *arg)
 {
 	struct ntsync_wait_args wait_args = {0};
-	__u32 index, count, i;
-	int ret;
+	__u32 count, i;
 
 	wait_args.timeout = UINT64_MAX;
 	wait_args.count = 1;
-- 
2.45.2
Re: [PATCH v2 02/13] selftests: ntsync: Fix build warnings
Posted by Elizabeth Figura 1 week, 3 days ago
On Friday, 5 December 2025 11:09:56 CST Guenter Roeck wrote:
> Fix
> 
> ntsync.c:1286:20: warning: call to undeclared function 'gettid';
> 	ISO C99 and later do not support implicit function declarations
>  1286 |         wait_args.owner = gettid();
>       |                           ^
> ntsync.c:1280:8: warning: unused variable 'index'
>  1280 |         __u32 index, count, i;
>       |               ^~~~~
> ntsync.c:1281:6: warning: unused variable 'ret'
>  1281 |         int ret;
> 
> by adding the missing include file and removing the unused variables.
> 
> Fixes: a22860e57b54 ("selftests: ntsync: Add a stress test for contended waits.")
> Cc: Elizabeth Figura <zfigura@codeweavers.com>
> Signed-off-by: Guenter Roeck <linux@roeck-us.net>
> ---
> v2: Update subject and description to reflect that the patch fixes build
>     warnings 
> 
>  tools/testing/selftests/drivers/ntsync/ntsync.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/tools/testing/selftests/drivers/ntsync/ntsync.c b/tools/testing/selftests/drivers/ntsync/ntsync.c
> index 3aad311574c4..d3df94047e4d 100644
> --- a/tools/testing/selftests/drivers/ntsync/ntsync.c
> +++ b/tools/testing/selftests/drivers/ntsync/ntsync.c
> @@ -11,6 +11,7 @@
>  #include <fcntl.h>
>  #include <time.h>
>  #include <pthread.h>
> +#include <unistd.h>
>  #include <linux/ntsync.h>
>  #include "../../kselftest_harness.h"
>  
> @@ -1277,8 +1278,7 @@ static int stress_device, stress_start_event, stress_mutex;
>  static void *stress_thread(void *arg)
>  {
>  	struct ntsync_wait_args wait_args = {0};
> -	__u32 index, count, i;
> -	int ret;
> +	__u32 count, i;
>  
>  	wait_args.timeout = UINT64_MAX;
>  	wait_args.count = 1;
> 

LGTM.

Reviewed-by: Elizabeth Figura <zfigura@codeweavers.com>