Message ID | 20240107151218.933806-4-mirsad.todorovac@alu.unizg.hr (mailing list archive) |
---|---|
State | New |
Headers | show |
Series | kselftest: alsa: Fix a couple of format specifiers and function parameters | expand |
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.
On 07. 01. 2024. 16:33, Mark Brown wrote: > 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. I double-checked and there is no warning, but I will fix it as you suggested. > 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. I am just looking at the `git log --oneline tools/testing/selftests/alsa` and I can't seem to get inspiration. I guess I can keep the Acked-by tags. Will the patchwork find the tag in the v1 patch set? Sorry for the lag in [PATCH v1 4/4]. I thought I pressed submit, but I obviously did not. Thanks, Mirsad
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.
s/ksellftest/kselftest/
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
On 07. 01. 2024. 19:40, Andreas Schwab wrote:
> s/ksellftest/kselftest/
Thx.
Fixed in v2.
Thanks,
Mirsad
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;
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(-)