2024-01-07 17:37:33

by Mirsad Todorovac

[permalink] [raw]
Subject: [PATCH v2 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters

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

--
2.40.1



2024-01-07 17:38:44

by Mirsad Todorovac

[permalink] [raw]
Subject: [PATCH v2 1/4] kselftest/alsa - mixer-test: fix the number of parameters to ksft_exit_fail_msg()

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 <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Mirsad Todorovac <[email protected]>
Acked-by: Mark Brown <[email protected]>
---
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);
}

--
2.40.1


2024-01-07 17:38:59

by Mirsad Todorovac

[permalink] [raw]
Subject: [PATCH v2 2/4] kselftest/alsa - mixer-test: Fix the print format specifier warning

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 <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Mirsad Todorovac <[email protected]>
Acked-by: Mark Brown <[email protected]>
---
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;
--
2.40.1


2024-01-07 17:40:08

by Mirsad Todorovac

[permalink] [raw]
Subject: [PATCH v2 3/4] kselftest/alsa - mixer-test: Fix the print format specifier warning

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 <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Mirsad Todorovac <[email protected]>
---
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;
--
2.40.1


2024-01-07 17:41:17

by Mirsad Todorovac

[permalink] [raw]
Subject: [PATCH v2 4/4] kselftest/alsa - conf: Stringify the printed errno in sysfs_get()

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 <[email protected]>
Cc: Jaroslav Kysela <[email protected]>
Cc: Takashi Iwai <[email protected]>
Cc: Shuah Khan <[email protected]>
Cc: [email protected]
Cc: [email protected]
Cc: [email protected]
Signed-off-by: Mirsad Todorovac <[email protected]>
---
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';
--
2.40.1


2024-01-08 17:05:49

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] kselftest/alsa - mixer-test: Fix the print format specifier warning

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 <[email protected]>


Attachments:
(No filename) (165.00 B)
signature.asc (499.00 B)
Download all attachments

2024-01-08 17:44:26

by Mark Brown

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] kselftest/alsa - conf: Stringify the printed errno in sysfs_get()

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 <[email protected]>


Attachments:
(No filename) (178.00 B)
signature.asc (499.00 B)
Download all attachments

2024-01-09 05:37:12

by Mirsad Todorovac

[permalink] [raw]
Subject: Re: [PATCH v2 4/4] kselftest/alsa - conf: Stringify the printed errno in sysfs_get()

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 <[email protected]>

Thank you very much for the review.

I guess now patchwork will do the rest required.

Thanks,
Mirsad

--
Mirsad 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
tel. +385 (0)1 3711 451
mob. +385 91 57 88 355

2024-01-09 14:16:55

by Takashi Iwai

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters

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

2024-01-09 19:23:55

by Mirsad Todorovac

[permalink] [raw]
Subject: Re: [PATCH v2 0/4] kselftest: alsa: Fix a couple of format specifiers and function parameters

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


--
Mirsad 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
tel. +385 (0)1 3711 451
mob. +385 91 57 88 355