RISC-V: selftests: Fix compiler warnings
PATCH 1/1 RISC-V: selftests: Fix compiler warnings
Since commit e33a02ed6a4f ("selftests: Add printf attribute to kselftest prints") RISC-V selftests are generating format warnings when compiled. Follow the warnings' instructions to fix them up.
Signed-off-by Andrew Jones <[email protected]>
--- tools/testing/selftests/riscv/hwprobe/cbo.c | 6 +++--- tools/testing/selftests/riscv/hwprobe/hwprobe.c | 4 ++-- tools/testing/selftests/riscv/vector/v_initval_nolibc.c | 2 +- tools/testing/selftests/riscv/vector/vstate_prctl.c | 4 ++-- 4 files changed, 8 insertions(+), 8 deletions(-)
tools/testing/selftests/riscv/hwprobe/cbo.c +3 -3
@@ -97,7 +97,7 @@ static void test_zicboz(void *arg) block_size = pair.value;ksft_test_result (rc ==0 && pair.key ==RISCV_HWPROBE_KEY_ZICBOZ_BLOCK_SIZE &&is_power_of_2 (block_size),"Zicboz block size\n" ); -ksft_print_msg ("Zicboz block size: %ld\n" , block_size); +ksft_print_msg ("Zicboz block size: %lld\n" , block_size); illegal_insn = false;cbo_zero (&mem[block_size]);
@@ -121,7 +121,7 @@ static void test_zicboz(void *arg)for (j =0 ; j < block_size; ++j) {if (mem[i * block_size + j] != expected) {ksft_test_result_fail ("cbo.zero check\n" ); -ksft_print_msg ("cbo.zero check: mem[%d] != 0x%x\n" , +ksft_print_msg ("cbo.zero check: mem[%lld] != 0x%x\n" , i * block_size + j, expected);return ; }
@@ -201,7 +201,7 @@ int main(int argc, char **argv) pair.key =RISCV_HWPROBE_KEY_IMA_EXT_0 ; rc =riscv_hwprobe (&pair,1 ,sizeof (cpu_set_t), (unsigned long *)&cpus,0 );if (rc <0 ) -ksft_exit_fail_msg ("hwprobe() failed with %d\n" , rc); +ksft_exit_fail_msg ("hwprobe() failed with %ld\n" , rc);assert (rc ==0 && pair.key ==RISCV_HWPROBE_KEY_IMA_EXT_0 );if (pair.value &RISCV_HWPROBE_EXT_ZICBOZ ) {
tools/testing/selftests/riscv/hwprobe/hwprobe.c +2 -2
@@ -29,7 +29,7 @@ int main(int argc, char **argv)/* Fail if the kernel claims not to recognize a base key. */ if ((i <4 ) && (pairs[i].key != i))ksft_exit_fail_msg ("Failed to recognize base key: key != i, " -"key=%ld, i=%ld\n" , pairs[i].key, i); +"key=%lld, i=%ld\n" , pairs[i].key, i);if (pairs[i].key !=RISCV_HWPROBE_KEY_BASE_BEHAVIOR )continue ;
@@ -37,7 +37,7 @@ int main(int argc, char **argv)if (pairs[i].value &RISCV_HWPROBE_BASE_BEHAVIOR_IMA )continue ; -ksft_exit_fail_msg ("Unexpected pair: (%ld, %ld)\n" , pairs[i].key, pairs[i].value); +ksft_exit_fail_msg ("Unexpected pair: (%lld, %lld)\n" , pairs[i].key, pairs[i].value); } out =riscv_hwprobe (pairs,8 ,0 ,0 ,0 );
tools/testing/selftests/riscv/vector/v_initval_nolibc.c +1 -1
@@ -27,7 +27,7 @@ int main(void) datap =malloc (MAX_VSIZE );if (!datap) { -ksft_test_result_fail ("fail to allocate memory for size = %lu\n" ,MAX_VSIZE ); +ksft_test_result_fail ("fail to allocate memory for size = %u\n" ,MAX_VSIZE );exit (-1 ); }
tools/testing/selftests/riscv/vector/vstate_prctl.c +2 -2
@@ -68,7 +68,7 @@ int test_and_compare_child(long provided, long expected, int inherit) } rc =launch_test (inherit);if (rc != expected) { -ksft_test_result_fail ("Test failed, check %d != %d\n" , rc, +ksft_test_result_fail ("Test failed, check %d != %ld\n" , rc, expected);return -2 ; }
@@ -87,7 +87,7 @@ int main(void) pair.key =RISCV_HWPROBE_KEY_IMA_EXT_0 ; rc =riscv_hwprobe (&pair,1 ,0 ,NULL ,0 );if (rc <0 ) { -ksft_test_result_fail ("hwprobe() failed with %d\n" , rc); +ksft_test_result_fail ("hwprobe() failed with %ld\n" , rc);return -1 ; }
Signature · 7 lines
2.41.0 _______________________________________________ linux-riscv mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-riscv