Re: [PATCH v2 4/8] selftests: vDSO: vdso_test_getrandom: Drop some dead code

From: Jason A. Donenfeld
Date: Mon May 05 2025 - 08:58:35 EST


Hi Thomas,

On Mon, May 5, 2025 at 11:19 AM Thomas Weißschuh
<thomas.weissschuh@xxxxxxxxxxxxx> wrote:
>
> vgetrandom_put_state() and the variable ret in kselftest() are never used.
>
> Drop the dead code.
>
> Signed-off-by: Thomas Weißschuh <thomas.weissschuh@xxxxxxxxxxxxx>
> Reviewed-by: Muhammad Usama Anjum <usama.anjum@xxxxxxxxxxxxx>
> ---
> tools/testing/selftests/vDSO/vdso_test_getrandom.c | 11 +----------
> 1 file changed, 1 insertion(+), 10 deletions(-)
>
> diff --git a/tools/testing/selftests/vDSO/vdso_test_getrandom.c b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> index f36e50f372f935e6d4da3175c81e210653bdce1d..b0e0d664508a38d6dde9df0a61ec8198ee928a17 100644
> --- a/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> +++ b/tools/testing/selftests/vDSO/vdso_test_getrandom.c
> @@ -100,15 +100,6 @@ static void *vgetrandom_get_state(void)
> return state;
> }
>
> -static void vgetrandom_put_state(void *state)
> -{
> - if (!state)
> - return;
> - pthread_mutex_lock(&vgrnd.lock);
> - vgrnd.states[vgrnd.len++] = state;
> - pthread_mutex_unlock(&vgrnd.lock);
> -}

This sort of acts as example code / basic reference code for libcs and
such. So I like having this function around. Could you just mark it as
unused with an attribute but otherwise keep it?

Jason