summaryrefslogtreecommitdiff
path: root/tools/testing
diff options
context:
space:
mode:
authorMichael Ellerman <mpe@ellerman.id.au>2022-08-01 11:48:34 +0300
committerMichael Ellerman <mpe@ellerman.id.au>2022-08-01 15:21:18 +0300
commitff446cd76854d47f451a84c26bb70934ae2ec5a7 (patch)
tree1249e564c78366f78a1483a5d38836837d656404 /tools/testing
parentdf5d4b616ee76abc97e5bd348e22659c2b095b1c (diff)
downloadlinux-ff446cd76854d47f451a84c26bb70934ae2ec5a7.tar.xz
selftests/powerpc: Avoid GCC 12 uninitialised variable warning
GCC 12 thinks that `actual` might be used uninitialised. It's not, the use is guarded by `bad_mmcr2` which is only set to true at the same point where `actual` is initialised. cycles_with_mmcr2_test.c: In function ‘cycles_with_mmcr2’: cycles_with_mmcr2_test.c:81:17: error: ‘actual’ may be used uninitialized [-Werror=maybe-uninitialized] 81 | printf("Bad MMCR2 value seen is 0x%lx\n", actual); Silence the warning by initialising `actual` to zero. Signed-off-by: Michael Ellerman <mpe@ellerman.id.au> Link: https://lore.kernel.org/r/20220801113746.802046-1-mpe@ellerman.id.au
Diffstat (limited to 'tools/testing')
-rw-r--r--tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
index 4b45a2e70f62..fc32187d483d 100644
--- a/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
+++ b/tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c
@@ -50,6 +50,7 @@ int cycles_with_mmcr2(void)
expected[1] = MMCR2_EXPECTED_2;
i = 0;
bad_mmcr2 = false;
+ actual = 0;
/* Make sure we loop until we take at least one EBB */
while ((ebb_state.stats.ebb_count < 20 && !bad_mmcr2) ||