[Devel] [PATCH vz10 03/15] selftests/damon: fix -Wunused-but-set-variable in huge_count_read_write

Vasileios Almpanis vasileios.almpanis at virtuozzo.com
Mon Mar 30 11:25:29 MSK 2026


Reviewed-by: Vasileios Almpanis <vasileios.almpanis at virtuozzo.com>

On 3/23/26 9:31 PM, Konstantin Khorenko wrote:
>    huge_count_read_write.c: In function 'write_read_with_huge_count':
>    huge_count_read_write.c:22:13: warning: variable 'ret' set but not used [-Wunused-but-set-variable]
>       22 |         int ret;
>          |             ^~~
>
> Remove unused 'ret' variable. The read() return value is not needed
> here -- the test only checks that huge count reads/writes don't cause
> kernel warnings.
>
> https://virtuozzo.atlassian.net/browse/VSTOR-127529
> Signed-off-by: Konstantin Khorenko <khorenko at virtuozzo.com>
>
> Feature: fix selftests
> ---
>   tools/testing/selftests/damon/huge_count_read_write.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/damon/huge_count_read_write.c b/tools/testing/selftests/damon/huge_count_read_write.c
> index a6fe0689f88d..fddc835ff8e7 100644
> --- a/tools/testing/selftests/damon/huge_count_read_write.c
> +++ b/tools/testing/selftests/damon/huge_count_read_write.c
> @@ -19,7 +19,6 @@ void write_read_with_huge_count(char *file)
>   {
>   	int filedesc = open(file, O_RDWR);
>   	char buf[25];
> -	int ret;
>   
>   	printf("%s %s\n", __func__, file);
>   	if (filedesc < 0) {
> @@ -29,7 +28,7 @@ void write_read_with_huge_count(char *file)
>   
>   	write(filedesc, "", 0xfffffffful);
>   	perror("after write: ");
> -	ret = read(filedesc, buf, 0xfffffffful);
> +	read(filedesc, buf, 0xfffffffful);
>   	perror("after read: ");
>   	close(filedesc);
>   }


More information about the Devel mailing list