* [PATCH v1 1/4] kselftest: alsa: fix the number of parameters to ksft_exit_fail_msg()
2024-01-07 15:12 [PATCH v1 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters Mirsad Todorovac
@ 2024-01-07 15:12 ` Mirsad Todorovac
2024-01-07 15:34 ` Mark Brown
2024-01-07 15:12 ` [PATCH v1 2/4] kselftest: alsa: Fix the printf format specifier in call to ksft_print_msg() Mirsad Todorovac
` (2 subsequent siblings)
3 siblings, 1 reply; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 15:12 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Mark Brown, linux-sound,
linux-kselftest, linux-kernel
Cc: Jaroslav Kysela, Takashi Iwai, Shuah Khan, Mirsad Todorovac
Fix the number of arguments to error reporting function in the test program
as reported in the GCC 13.2.0 warning:
mixer-test.c: In function ‘find_controls’:
mixer-test.c:169:44: warning: too many arguments for format [-Wformat-extra-args]
169 | ksft_exit_fail_msg("snd_ctl_poll_descriptors() failed for %d\n",
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
The number of arguments in call to ksft_exit_fail_msg() doesn't correspond
to the format specifiers, so this is adjusted to mimic the sibling calls
to the error function.
Fixes: b1446bda56456 ("kselftest: alsa: Check for event generation when we write to controls")
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(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index 23df154fcdd7..208c2170c074 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -166,7 +166,7 @@ static void find_controls(void)
err = snd_ctl_poll_descriptors(card_data->handle,
&card_data->pollfd, 1);
if (err != 1) {
- ksft_exit_fail_msg("snd_ctl_poll_descriptors() failed for %d\n",
+ ksft_exit_fail_msg("snd_ctl_poll_descriptors() failed for card %d: %d\n",
card, err);
}
--
2.40.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v1 1/4] kselftest: alsa: fix the number of parameters to ksft_exit_fail_msg()
2024-01-07 15:12 ` [PATCH v1 1/4] kselftest: alsa: fix the number of parameters to ksft_exit_fail_msg() Mirsad Todorovac
@ 2024-01-07 15:34 ` Mark Brown
0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2024-01-07 15:34 UTC (permalink / raw)
To: Mirsad Todorovac
Cc: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel, Jaroslav Kysela, Takashi Iwai, Shuah Khan
[-- Attachment #1: Type: text/plain, Size: 229 bytes --]
On Sun, Jan 07, 2024 at 04:12:16PM +0100, Mirsad Todorovac wrote:
> Fix the number of arguments to error reporting function in the test program
> as reported in the GCC 13.2.0 warning:
Acked-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 2/4] kselftest: alsa: Fix the printf format specifier in call to ksft_print_msg()
2024-01-07 15:12 [PATCH v1 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters Mirsad Todorovac
2024-01-07 15:12 ` [PATCH v1 1/4] kselftest: alsa: fix the number of parameters to ksft_exit_fail_msg() Mirsad Todorovac
@ 2024-01-07 15:12 ` Mirsad Todorovac
2024-01-07 15:30 ` Mark Brown
2024-01-07 15:12 ` [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int Mirsad Todorovac
2024-01-07 16:07 ` [PATCH v1 4/4] selftests: alsa: Fix the exit error message parameter in sysfs_get() Mirsad Todorovac
3 siblings, 1 reply; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 15:12 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Mark Brown, linux-sound,
linux-kselftest, linux-kernel
Cc: Jaroslav Kysela, Takashi Iwai, Shuah Khan, Mirsad Todorovac
The GCC 13.2.0 compiler issued the following warning:
mixer-test.c: In function ‘ctl_value_index_valid’:
mixer-test.c:322:79: warning: format ‘%lld’ expects argument of type ‘long long int’, \
but argument 5 has type ‘long int’ [-Wformat=]
322 | ksft_print_msg("%s.%d value %lld more than maximum %lld\n",
| ~~~^
| |
| long long int
| %ld
323 | ctl->name, index, int64_val,
324 | snd_ctl_elem_info_get_max(ctl->info));
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| |
| long int
Fixing the format specifier as advised by the compiler suggestion removes the
warning.
Fixes: 3f48b137d88e7 ("kselftest: alsa: Factor out check that values meet constraints")
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(-)
diff --git a/tools/testing/selftests/alsa/mixer-test.c b/tools/testing/selftests/alsa/mixer-test.c
index 208c2170c074..df942149c6f6 100644
--- a/tools/testing/selftests/alsa/mixer-test.c
+++ b/tools/testing/selftests/alsa/mixer-test.c
@@ -319,7 +319,7 @@ static bool ctl_value_index_valid(struct ctl_data *ctl,
}
if (int64_val > snd_ctl_elem_info_get_max64(ctl->info)) {
- ksft_print_msg("%s.%d value %lld more than maximum %lld\n",
+ ksft_print_msg("%s.%d value %lld more than maximum %ld\n",
ctl->name, index, int64_val,
snd_ctl_elem_info_get_max(ctl->info));
return false;
--
2.40.1
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v1 2/4] kselftest: alsa: Fix the printf format specifier in call to ksft_print_msg()
2024-01-07 15:12 ` [PATCH v1 2/4] kselftest: alsa: Fix the printf format specifier in call to ksft_print_msg() Mirsad Todorovac
@ 2024-01-07 15:30 ` Mark Brown
0 siblings, 0 replies; 13+ messages in thread
From: Mark Brown @ 2024-01-07 15:30 UTC (permalink / raw)
To: Mirsad Todorovac
Cc: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel, Jaroslav Kysela, Takashi Iwai, Shuah Khan
[-- Attachment #1: Type: text/plain, Size: 667 bytes --]
On Sun, Jan 07, 2024 at 04:12:18PM +0100, Mirsad Todorovac wrote:
> The GCC 13.2.0 compiler issued the following warning:
>
> mixer-test.c: In function ‘ctl_value_index_valid’:
> mixer-test.c:322:79: warning: format ‘%lld’ expects argument of type ‘long long int’, \
Acked-by: Mark Brown <broonie@kernel.org>
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 15:12 [PATCH v1 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters Mirsad Todorovac
2024-01-07 15:12 ` [PATCH v1 1/4] kselftest: alsa: fix the number of parameters to ksft_exit_fail_msg() Mirsad Todorovac
2024-01-07 15:12 ` [PATCH v1 2/4] kselftest: alsa: Fix the printf format specifier in call to ksft_print_msg() Mirsad Todorovac
@ 2024-01-07 15:12 ` Mirsad Todorovac
2024-01-07 15:33 ` Mark Brown
2024-01-07 18:40 ` Andreas Schwab
2024-01-07 16:07 ` [PATCH v1 4/4] selftests: alsa: Fix the exit error message parameter in sysfs_get() Mirsad Todorovac
3 siblings, 2 replies; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 15:12 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, Mark Brown, linux-sound,
linux-kselftest, linux-kernel
Cc: Jaroslav Kysela, Takashi Iwai, Shuah Khan, Mirsad Todorovac
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(-)
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
^ permalink raw reply related [flat|nested] 13+ messages in thread* Re: [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 15:12 ` [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int Mirsad Todorovac
@ 2024-01-07 15:33 ` Mark Brown
2024-01-07 16:21 ` Mirsad Todorovac
2024-01-07 18:40 ` Andreas Schwab
1 sibling, 1 reply; 13+ messages in thread
From: Mark Brown @ 2024-01-07 15:33 UTC (permalink / raw)
To: Mirsad Todorovac
Cc: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel, Jaroslav Kysela, Takashi Iwai, Shuah Khan
[-- Attachment #1: Type: text/plain, Size: 947 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 15:33 ` Mark Brown
@ 2024-01-07 16:21 ` Mirsad Todorovac
2024-01-07 18:14 ` Mark Brown
0 siblings, 1 reply; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 16:21 UTC (permalink / raw)
To: Mark Brown
Cc: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel, Jaroslav Kysela, Takashi Iwai, Shuah Khan
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
--
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
"I see something approaching fast ... Will it be friends with me?"
^ permalink raw reply [flat|nested] 13+ messages in thread* Re: [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 16:21 ` Mirsad Todorovac
@ 2024-01-07 18:14 ` Mark Brown
2024-01-07 18:43 ` Mirsad Todorovac
0 siblings, 1 reply; 13+ messages in thread
From: Mark Brown @ 2024-01-07 18:14 UTC (permalink / raw)
To: Mirsad Todorovac
Cc: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel, Jaroslav Kysela, Takashi Iwai, Shuah Khan
[-- Attachment #1: Type: text/plain, Size: 191 bytes --]
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.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 18:14 ` Mark Brown
@ 2024-01-07 18:43 ` Mirsad Todorovac
0 siblings, 0 replies; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 18:43 UTC (permalink / raw)
To: Mark Brown
Cc: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel, Jaroslav Kysela, Takashi Iwai, Shuah Khan
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 Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
"I see something approaching fast ... Will it be friends with me?"
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 15:12 ` [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int Mirsad Todorovac
2024-01-07 15:33 ` Mark Brown
@ 2024-01-07 18:40 ` Andreas Schwab
2024-01-07 19:15 ` Mirsad Todorovac
1 sibling, 1 reply; 13+ messages in thread
From: Andreas Schwab @ 2024-01-07 18:40 UTC (permalink / raw)
To: Mirsad Todorovac
Cc: Nícolas F. R. A. Prado, Mark Brown, linux-sound,
linux-kselftest, linux-kernel, Jaroslav Kysela, Takashi Iwai,
Shuah Khan
s/ksellftest/kselftest/
--
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510 2552 DF73 E780 A9DA AEC1
"And now for something completely different."
^ permalink raw reply [flat|nested] 13+ messages in thread
* Re: [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int
2024-01-07 18:40 ` Andreas Schwab
@ 2024-01-07 19:15 ` Mirsad Todorovac
0 siblings, 0 replies; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 19:15 UTC (permalink / raw)
To: Andreas Schwab
Cc: Nícolas F. R. A. Prado, Mark Brown, linux-sound,
linux-kselftest, linux-kernel, Jaroslav Kysela, Takashi Iwai,
Shuah Khan
On 07. 01. 2024. 19:40, Andreas Schwab wrote:
> s/ksellftest/kselftest/
Thx.
Fixed in v2.
Thanks,
Mirsad
--
Mirsad Goran Todorovac
Sistem inženjer
Grafički fakultet | Akademija likovnih umjetnosti
Sveučilište u Zagrebu
System engineer
Faculty of Graphic Arts | Academy of Fine Arts
University of Zagreb, Republic of Croatia
The European Union
"I see something approaching fast ... Will it be friends with me?"
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH v1 4/4] selftests: alsa: Fix the exit error message parameter in sysfs_get()
2024-01-07 15:12 [PATCH v1 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters Mirsad Todorovac
` (2 preceding siblings ...)
2024-01-07 15:12 ` [PATCH v1 3/4] ksellftest: alsa: Fix the printf format specifier to unsigned int Mirsad Todorovac
@ 2024-01-07 16:07 ` Mirsad Todorovac
3 siblings, 0 replies; 13+ messages in thread
From: Mirsad Todorovac @ 2024-01-07 16:07 UTC (permalink / raw)
To: Nícolas F. R. A. Prado, linux-sound, linux-kselftest,
linux-kernel
Cc: Jaroslav Kysela, Takashi Iwai, Mark Brown, Shuah Khan,
Mirsad Todorovac
GCC 13.2.0 reported the warning of the print format specifier:
conf.c: In function ‘sysfs_get’:
conf.c:181:72: warning: format ‘%s’ expects argument of type ‘char *’, \
but argument 3 has type ‘int’ [-Wformat=]
181 | ksft_exit_fail_msg("sysfs: unable to read value '%s': %s\n",
| ~^
| |
| char *
| %d
The fix passes strerror(errno) as it was intended, like in the sibling error
exit message.
Fixes: aba51cd0949ae ("selftests: alsa - add PCM test")
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/conf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tools/testing/selftests/alsa/conf.c b/tools/testing/selftests/alsa/conf.c
index 00925eb8d9f4..89e3656a042d 100644
--- a/tools/testing/selftests/alsa/conf.c
+++ b/tools/testing/selftests/alsa/conf.c
@@ -179,7 +179,7 @@ static char *sysfs_get(const char *sysfs_root, const char *id)
close(fd);
if (len < 0)
ksft_exit_fail_msg("sysfs: unable to read value '%s': %s\n",
- path, errno);
+ path, strerror(errno));
while (len > 0 && path[len-1] == '\n')
len--;
path[len] = '\0';
--
2.40.1
^ permalink raw reply related [flat|nested] 13+ messages in thread