tools: selftests: riscv: Fix compile warnings in cbo
authorChristoph Müllner <christoph.muellner@vrull.eu>
Thu, 23 Nov 2023 18:58:18 +0000 (19:58 +0100)
committerPalmer Dabbelt <palmer@rivosinc.com>
Thu, 11 Jan 2024 16:02:48 +0000 (08:02 -0800)
GCC prints a couple of format string warnings when compiling
the cbo test. Let's follow the recommendation in
Documentation/printk-formats.txt to fix these warnings.

Signed-off-by: Christoph Müllner <christoph.muellner@vrull.eu>
Reviewed-by: Alexandre Ghiti <alexghiti@rivosinc.com>
Reviewed-by: Andrew Jones <ajones@ventanamicro.com>
Link: https://lore.kernel.org/r/20231123185821.2272504-3-christoph.muellner@vrull.eu
Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
tools/testing/selftests/riscv/hwprobe/cbo.c

index 50a2cc8aef387cacc2444d5fa7264c8953e5d0b8..c6a83ab11e22336464b499a6127b9910b548efcb 100644 (file)
@@ -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: %llu\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[%llu] != 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) {