* [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format
@ 2023-05-24 19:15 Mirsad Goran Todorovac
2023-05-25 9:22 ` Mark Brown
2023-06-05 7:16 ` Takashi Iwai
0 siblings, 2 replies; 4+ messages in thread
From: Mirsad Goran Todorovac @ 2023-05-24 19:15 UTC (permalink / raw)
To: Takashi Iwai, Mark Brown, Jaroslav Kysela, alsa-devel,
linux-kselftest, linux-kernel
Cc: Takashi Iwai, Shuah Khan, Mirsad Goran Todorovac
GCC 11.3.0 issues warnings in this module about wrong sizes of format
specifiers:
pcm-test.c: In function ‘test_pcm_time’:
pcm-test.c:384:68: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 \
has type ‘unsigned int’ [-Wformat=]
384 | snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate);
pcm-test.c:455:53: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has \
type ‘long int’ [-Wformat=]
455 | "expected %d, wrote %li", rate, frames);
pcm-test.c:462:53: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has \
type ‘long int’ [-Wformat=]
462 | "expected %d, wrote %li", rate, frames);
pcm-test.c:467:53: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has \
type ‘long int’ [-Wformat=]
467 | "expected %d, wrote %li", rate, frames);
Simple fix according to compiler's suggestion removed the warnings.
Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
---
tools/testing/selftests/alsa/pcm-test.c | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c
index 3e390fe67eb9..b7eef32addb4 100644
--- a/tools/testing/selftests/alsa/pcm-test.c
+++ b/tools/testing/selftests/alsa/pcm-test.c
@@ -381,7 +381,7 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class,
goto __close;
}
if (rrate != rate) {
- snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate);
+ snprintf(msg, sizeof(msg), "rate mismatch %ld != %d", rate, rrate);
goto __close;
}
rperiod_size = period_size;
@@ -447,24 +447,24 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class,
frames = snd_pcm_writei(handle, samples, rate);
if (frames < 0) {
snprintf(msg, sizeof(msg),
- "Write failed: expected %d, wrote %li", rate, frames);
+ "Write failed: expected %ld, wrote %li", rate, frames);
goto __close;
}
if (frames < rate) {
snprintf(msg, sizeof(msg),
- "expected %d, wrote %li", rate, frames);
+ "expected %ld, wrote %li", rate, frames);
goto __close;
}
} else {
frames = snd_pcm_readi(handle, samples, rate);
if (frames < 0) {
snprintf(msg, sizeof(msg),
- "expected %d, wrote %li", rate, frames);
+ "expected %ld, wrote %li", rate, frames);
goto __close;
}
if (frames < rate) {
snprintf(msg, sizeof(msg),
- "expected %d, wrote %li", rate, frames);
+ "expected %ld, wrote %li", rate, frames);
goto __close;
}
}
--
2.34.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format
2023-05-24 19:15 [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format Mirsad Goran Todorovac
@ 2023-05-25 9:22 ` Mark Brown
2023-05-26 19:25 ` Mirsad Goran Todorovac
2023-06-05 7:16 ` Takashi Iwai
1 sibling, 1 reply; 4+ messages in thread
From: Mark Brown @ 2023-05-25 9:22 UTC (permalink / raw)
To: Mirsad Goran Todorovac
Cc: Takashi Iwai, Jaroslav Kysela, alsa-devel, linux-kselftest,
linux-kernel, Takashi Iwai, Shuah Khan
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
On Wed, May 24, 2023 at 09:15:29PM +0200, Mirsad Goran Todorovac wrote:
> GCC 11.3.0 issues warnings in this module about wrong sizes of format
> specifiers:
Reviewed-by: Mark Brown <broonie@kernel.org>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format
2023-05-25 9:22 ` Mark Brown
@ 2023-05-26 19:25 ` Mirsad Goran Todorovac
0 siblings, 0 replies; 4+ messages in thread
From: Mirsad Goran Todorovac @ 2023-05-26 19:25 UTC (permalink / raw)
To: Mark Brown
Cc: Takashi Iwai, Jaroslav Kysela, alsa-devel, linux-kselftest,
linux-kernel, Takashi Iwai, Shuah Khan
On 5/25/23 11:22, Mark Brown wrote:
> On Wed, May 24, 2023 at 09:15:29PM +0200, Mirsad Goran Todorovac wrote:
>> GCC 11.3.0 issues warnings in this module about wrong sizes of format
>> specifiers:
>
> Reviewed-by: Mark Brown <broonie@kernel.org>
Thanks,
Mirsad
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format
2023-05-24 19:15 [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format Mirsad Goran Todorovac
2023-05-25 9:22 ` Mark Brown
@ 2023-06-05 7:16 ` Takashi Iwai
1 sibling, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2023-06-05 7:16 UTC (permalink / raw)
To: Mirsad Goran Todorovac
Cc: Mark Brown, Jaroslav Kysela, alsa-devel, linux-kselftest,
linux-kernel, Takashi Iwai, Shuah Khan
On Wed, 24 May 2023 21:15:29 +0200,
Mirsad Goran Todorovac wrote:
>
> GCC 11.3.0 issues warnings in this module about wrong sizes of format
> specifiers:
>
> pcm-test.c: In function ‘test_pcm_time’:
> pcm-test.c:384:68: warning: format ‘%ld’ expects argument of type ‘long int’, but argument 5 \
> has type ‘unsigned int’ [-Wformat=]
> 384 | snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate);
> pcm-test.c:455:53: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has \
> type ‘long int’ [-Wformat=]
> 455 | "expected %d, wrote %li", rate, frames);
> pcm-test.c:462:53: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has \
> type ‘long int’ [-Wformat=]
> 462 | "expected %d, wrote %li", rate, frames);
> pcm-test.c:467:53: warning: format ‘%d’ expects argument of type ‘int’, but argument 4 has \
> type ‘long int’ [-Wformat=]
> 467 | "expected %d, wrote %li", rate, frames);
>
> Simple fix according to compiler's suggestion removed the warnings.
>
> Signed-off-by: Mirsad Goran Todorovac <mirsad.todorovac@alu.unizg.hr>
Applied now. Thanks.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-06-05 7:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-05-24 19:15 [PATCH v1 1/1] selftests: alsa: pcm-test: Fix compiler warnings about the format Mirsad Goran Todorovac
2023-05-25 9:22 ` Mark Brown
2023-05-26 19:25 ` Mirsad Goran Todorovac
2023-06-05 7:16 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox