Minor fixes of compiler warnings and one bug in the number of parameters which would not crash the test but it is better fixed for correctness sake.
As the general climate in the Linux kernel community is to fix all compiler warnings, this could be on the right track, even if only in the testing suite.
Changelog:
v1 -> v2: - Compared to v1, commit subject lines have been adjusted to reflect the style of the subsystem, as suggested by Mark. - 1/4 was already acked and unchanged (adjusted the subject line as suggested) (code unchanged) - 2/4 was acked with suggestion to adjust the subject line (done). (code unchanged) - 3/4 The format specifier was changed from %d to %u as suggested. - The 4/4 submitted for review (in the v1 it was delayed by an omission). (code unchanged)
Mirsad Todorovac (4): kselftest/alsa - mixer-test: fix the number of parameters to ksft_exit_fail_msg() kselftest/alsa - mixer-test: Fix the print format specifier warning kselftest/alsa - mixer-test: Fix the print format specifier warning kselftest/alsa - conf: Stringify the printed errno in sysfs_get()
tools/testing/selftests/alsa/conf.c | 2 +- tools/testing/selftests/alsa/mixer-test.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-)
Minor fix in the number of arguments to error reporting function in the test program as reported by 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 resembling 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 Acked-by: Mark Brown broonie@kernel.org --- v1 -> v2: Changed the subject line as suggested to reflect the style of the subsystem. No change to the reviewed code.
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); }
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 Acked-by: Mark Brown broonie@kernel.org --- v1 -> v2: Changed the subject line as suggested to reflect the style of the subsystem. No change to the reviewed code.
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;
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(-)
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;
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
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 --- v1 -> v2: Changed the subject line as suggested to reflect the style of the subsystem. No change to the code.
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';
On Sun, Jan 07, 2024 at 06:37:08PM +0100, Mirsad Todorovac wrote:
GCC 13.2.0 reported the warning of the print format specifier:
Acked-by: Mark Brown broonie@kernel.org
On 1/8/2024 6:37 PM, Mark Brown wrote:
On Sun, Jan 07, 2024 at 06:37:08PM +0100, Mirsad Todorovac wrote:
GCC 13.2.0 reported the warning of the print format specifier:
Acked-by: Mark Brown broonie@kernel.org
Thank you very much for the review.
I guess now patchwork will do the rest required.
Thanks, Mirsad
On Sun, 07 Jan 2024 18:37:00 +0100, Mirsad Todorovac wrote:
Minor fixes of compiler warnings and one bug in the number of parameters which would not crash the test but it is better fixed for correctness sake.
As the general climate in the Linux kernel community is to fix all compiler warnings, this could be on the right track, even if only in the testing suite.
Changelog:
v1 -> v2:
- Compared to v1, commit subject lines have been adjusted to reflect the style of the subsystem, as suggested by Mark.
- 1/4 was already acked and unchanged (adjusted the subject line as suggested) (code unchanged)
- 2/4 was acked with suggestion to adjust the subject line (done). (code unchanged)
- 3/4 The format specifier was changed from %d to %u as suggested.
- The 4/4 submitted for review (in the v1 it was delayed by an omission). (code unchanged)
Mirsad Todorovac (4): kselftest/alsa - mixer-test: fix the number of parameters to ksft_exit_fail_msg() kselftest/alsa - mixer-test: Fix the print format specifier warning kselftest/alsa - mixer-test: Fix the print format specifier warning kselftest/alsa - conf: Stringify the printed errno in sysfs_get()
Applied all patches now. Thanks.
Takashi
On 1/9/2024 3:16 PM, Takashi Iwai wrote:
On Sun, 07 Jan 2024 18:37:00 +0100, Mirsad Todorovac wrote:
Minor fixes of compiler warnings and one bug in the number of parameters which would not crash the test but it is better fixed for correctness sake.
As the general climate in the Linux kernel community is to fix all compiler warnings, this could be on the right track, even if only in the testing suite.
Changelog:
v1 -> v2:
- Compared to v1, commit subject lines have been adjusted to reflect the style of the subsystem, as suggested by Mark.
- 1/4 was already acked and unchanged (adjusted the subject line as suggested) (code unchanged)
- 2/4 was acked with suggestion to adjust the subject line (done). (code unchanged)
- 3/4 The format specifier was changed from %d to %u as suggested.
- The 4/4 submitted for review (in the v1 it was delayed by an omission). (code unchanged)
Mirsad Todorovac (4): kselftest/alsa - mixer-test: fix the number of parameters to ksft_exit_fail_msg() kselftest/alsa - mixer-test: Fix the print format specifier warning kselftest/alsa - mixer-test: Fix the print format specifier warning kselftest/alsa - conf: Stringify the printed errno in sysfs_get()
Applied all patches now. Thanks.
Takashi
No, thanks to you for your patient work. I realise that there are roughly 2,000 patch emails each day.
This might seem like sugarcoating, but I realise the developers are under a great stress having to evaluate such number of patches each day. The kernel is now close to 35+ Mlines and I do not underestimate this work.
I'm nowhere close to understanding all subsystems, but I recognise the need to be disciplined to make the maintainer's job easier and feasible in the long run.
The time invested in the Linux kernel and operating system is a gift that keeps on giving :-)
Regards, Mirsad
linux-kselftest-mirror@lists.linaro.org