Skip to content

Commit ff446cd

Browse files
committed
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
1 parent df5d4b6 commit ff446cd

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

tools/testing/selftests/powerpc/pmu/ebb/cycles_with_mmcr2_test.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ int cycles_with_mmcr2(void)
5050
expected[1] = MMCR2_EXPECTED_2;
5151
i = 0;
5252
bad_mmcr2 = false;
53+
actual = 0;
5354

5455
/* Make sure we loop until we take at least one EBB */
5556
while ((ebb_state.stats.ebb_count < 20 && !bad_mmcr2) ||

0 commit comments

Comments
 (0)