diff mbox series

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

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

Commit Message

Mirsad Todorovac Jan. 7, 2024, 3:12 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>
---
 tools/testing/selftests/alsa/mixer-test.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Mark Brown Jan. 7, 2024, 3:33 p.m. UTC | #1
On Sun, Jan 07, 2024 at 04:12:20PM +0100, Mirsad Todorovac wrote:

> mixer-test.c:350:80: warning: format ‘%ld’ expects argument of type ‘long int’, \
> 			      but argument 5 has type ‘unsigned int’ [-Wformat=]

If this is the issue then...

> -			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));

...why are we not using an unsigned format specifier here?  I am very
suprised this doesn't continue to warn.

Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
Mark Brown Jan. 7, 2024, 6:14 p.m. UTC | #2
On Sun, Jan 07, 2024 at 05:21:00PM +0100, Mirsad Todorovac wrote:

> I guess I can keep the Acked-by tags. Will the patchwork find the tag in
> the v1 patch set?

No, you need to include it.
Andreas Schwab Jan. 7, 2024, 6:40 p.m. UTC | #3
s/ksellftest/kselftest/
Mirsad Todorovac Jan. 7, 2024, 6:43 p.m. UTC | #4
On 07. 01. 2024. 19:14, Mark Brown wrote:
> On Sun, Jan 07, 2024 at 05:21:00PM +0100, Mirsad Todorovac wrote:
> 
>> I guess I can keep the Acked-by tags. Will the patchwork find the tag in
>> the v1 patch set?
> 
> No, you need to include it.

Great. Sent v2 for review.

I heard that there is a rule "one version per day or when confirmed"?

Nevertheless, these are minor fixes in the error reporting logic (though
no change is small enough to bee taken lightly), so I am sending now
because I don't know about the load tomorrow.

Please find v2 of the patch set on the LKML.

Kept two ACKs (code unchnaged), two left to review.

Thanks,
Mirsad
Mirsad Todorovac Jan. 7, 2024, 7:15 p.m. UTC | #5
On 07. 01. 2024. 19:40, Andreas Schwab wrote:
> s/ksellftest/kselftest/

Thx.

Fixed in v2.

Thanks,
Mirsad
diff mbox series

Patch

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;