[PATCH] Fix snprintf format warnings during 'alsa' kselftest compilation

From: Ivan Orlov
Date: Thu Feb 23 2023 - 09:32:34 EST


Fix 'alsa' kselftest compilation warnings by making snprintf
format correspond the actual parameters types.

Signed-off-by: Ivan Orlov <ivan.orlov0322@xxxxxxxxx>
---
tools/testing/selftests/alsa/pcm-test.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/tools/testing/selftests/alsa/pcm-test.c b/tools/testing/selftests/alsa/pcm-test.c
index f293c7d81009..52b109a162c6 100644
--- a/tools/testing/selftests/alsa/pcm-test.c
+++ b/tools/testing/selftests/alsa/pcm-test.c
@@ -318,7 +318,7 @@ static void test_pcm_time1(struct pcm_data *data,
goto __close;
}
if (rchannels != channels) {
- snprintf(msg, sizeof(msg), "channels unsupported %ld != %ld", channels, rchannels);
+ snprintf(msg, sizeof(msg), "channels unsupported %ld != %u", channels, rchannels);
skip = true;
goto __close;
}
@@ -329,7 +329,7 @@ static void test_pcm_time1(struct pcm_data *data,
goto __close;
}
if (rrate != rate) {
- snprintf(msg, sizeof(msg), "rate unsupported %ld != %ld", rate, rrate);
+ snprintf(msg, sizeof(msg), "rate unsupported %ld != %u", rate, rrate);
skip = true;
goto __close;
}
@@ -393,24 +393,24 @@ static void test_pcm_time1(struct pcm_data *data,
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