diff mbox series

[v2,3/4] kselftest/alsa - mixer-test: Fix the print format specifier warning

Message ID 20240107173704.937824-4-mirsad.todorovac@alu.unizg.hr
State Superseded
Headers show
Series kselftest: alsa: Fix a couple of format specifiers and function parameters | expand

Commit Message

Mirsad Todorovac Jan. 7, 2024, 5:37 p.m. UTC
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@kernel.org>
Cc: Jaroslav Kysela <perex@perex.cz>
Cc: Takashi Iwai <tiwai@suse.com>
Cc: Shuah Khan <shuah@kernel.org>
Cc: linux-sound@vger.kernel.org
Cc: linux-kselftest@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Mirsad Todorovac <mirsad.todorovac@alu.unizg.hr>
---
v1 -> v2:
 Changed the subject line as suggested to reflect the style of the subsystem.
 Changed format from %d to %u as suggested.

 tools/testing/selftests/alsa/mixer-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Jan. 8, 2024, 5:05 p.m. UTC | #1
On Sun, Jan 07, 2024 at 06:37:06PM +0100, Mirsad Todorovac wrote:
> GCC 13.2.0 compiler issued the following warning:

Acked-by: Mark Brown <broonie@kernel.org>
diff mbox series

Patch

diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index df942149c6f6..1c04e5f638a0 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 %u\n",
 				       ctl->name, index, int_val,
 				       snd_ctl_elem_info_get_items(ctl->info));
 			return false;