[PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int

From: Mirsad Todorovac
Date: Sun Jan 07 2024 - 10:14:15 EST


GCC 13.2.0 compiler issued the following warning:

mixer-test.c:350:80: warning: format ‘%ld’ expects argument of type ‘long int’, \
but argument 5 has type ‘unsigned int’ [-Wformat=]
350 | ksft_print_msg("%s.%d value %ld more than item count %ld\n",
| ~~^
| |
| long int
| %d
351 | ctl->name, index, int_val,
352 | snd_ctl_elem_info_get_items(ctl->info));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| unsigned int

Fixing the format specifier in call to ksft_print_msg() according to the
compiler suggestion silences the warning.

Fixes: 10f2f194663af ("kselftest: alsa: Validate values read from enumerations")
Cc: Mark Brown <broonie@xxxxxxxxxx>
Cc: Jaroslav Kysela <perex@xxxxxxxx>
Cc: Takashi Iwai <tiwai@xxxxxxxx>
Cc: Shuah Khan <shuah@xxxxxxxxxx>
Cc: linux-sound@xxxxxxxxxxxxxxx
Cc: linux-kselftest@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
Signed-off-by: Mirsad Todorovac <mirsad.todorovac@xxxxxxxxxxxx>
---
tools/testing/selftests/alsa/mixer-test.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index df942149c6f6..e3708cc52db7 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -347,7 +347,7 @@ static bool ctl_value_index_valid(struct ctl_data *ctl,
}

if (int_val >= snd_ctl_elem_info_get_items(ctl->info)) {
- ksft_print_msg("%s.%d value %ld more than item count %ld\n",
+ ksft_print_msg("%s.%d value %ld more than item count %d\n",
ctl->name, index, int_val,
snd_ctl_elem_info_get_items(ctl->info));
return false;
--
2.40.1