Skip to content

Commit bd57488

Browse files
Mirsad Goran Todorovactiwai
authored andcommitted
selftests: alsa: pcm-test: Fix compiler warnings about the format
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 <[email protected]> Reviewed-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 4ca110c commit bd57488

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

tools/testing/selftests/alsa/pcm-test.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -381,7 +381,7 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class,
381381
goto __close;
382382
}
383383
if (rrate != rate) {
384-
snprintf(msg, sizeof(msg), "rate mismatch %ld != %ld", rate, rrate);
384+
snprintf(msg, sizeof(msg), "rate mismatch %ld != %d", rate, rrate);
385385
goto __close;
386386
}
387387
rperiod_size = period_size;
@@ -447,24 +447,24 @@ static void test_pcm_time(struct pcm_data *data, enum test_class class,
447447
frames = snd_pcm_writei(handle, samples, rate);
448448
if (frames < 0) {
449449
snprintf(msg, sizeof(msg),
450-
"Write failed: expected %d, wrote %li", rate, frames);
450+
"Write failed: expected %ld, wrote %li", rate, frames);
451451
goto __close;
452452
}
453453
if (frames < rate) {
454454
snprintf(msg, sizeof(msg),
455-
"expected %d, wrote %li", rate, frames);
455+
"expected %ld, wrote %li", rate, frames);
456456
goto __close;
457457
}
458458
} else {
459459
frames = snd_pcm_readi(handle, samples, rate);
460460
if (frames < 0) {
461461
snprintf(msg, sizeof(msg),
462-
"expected %d, wrote %li", rate, frames);
462+
"expected %ld, wrote %li", rate, frames);
463463
goto __close;
464464
}
465465
if (frames < rate) {
466466
snprintf(msg, sizeof(msg),
467-
"expected %d, wrote %li", rate, frames);
467+
"expected %ld, wrote %li", rate, frames);
468468
goto __close;
469469
}
470470
}

0 commit comments

Comments
 (0)