Skip to content

Commit d78c8e3

Browse files
roxellmpe
authored andcommitted
powerpc/mm: Rearrange if-else block to avoid clang warning
Clang warns: arch/powerpc/mm/book3s64/radix_tlb.c:1191:23: error: variable 'hstart' is uninitialized when used here __tlbiel_va_range(hstart, hend, pid, ^~~~~~ arch/powerpc/mm/book3s64/radix_tlb.c:1191:31: error: variable 'hend' is uninitialized when used here __tlbiel_va_range(hstart, hend, pid, ^~~~ Rework the 'if (IS_ENABLE(CONFIG_TRANSPARENT_HUGEPAGE))' so hstart/hend is always initialized to silence the warnings. That will also simplify the 'else' path. Clang is getting confused with these warnings, but the warnings is a false-positive. Suggested-by: Arnd Bergmann <[email protected]> Suggested-by: Nathan Chancellor <[email protected]> Reviewed-by: Christophe Leroy <[email protected]> Reviewed-by: Nathan Chancellor <[email protected]> Signed-off-by: Anders Roxell <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent a7caf3f commit d78c8e3

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

arch/powerpc/mm/book3s64/radix_tlb.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1184,15 +1184,12 @@ static inline void __radix__flush_tlb_range(struct mm_struct *mm,
11841184
}
11851185
}
11861186
} else {
1187-
bool hflush = false;
1187+
bool hflush;
11881188
unsigned long hstart, hend;
11891189

1190-
if (IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE)) {
1191-
hstart = (start + PMD_SIZE - 1) & PMD_MASK;
1192-
hend = end & PMD_MASK;
1193-
if (hstart < hend)
1194-
hflush = true;
1195-
}
1190+
hstart = (start + PMD_SIZE - 1) & PMD_MASK;
1191+
hend = end & PMD_MASK;
1192+
hflush = IS_ENABLED(CONFIG_TRANSPARENT_HUGEPAGE) && hstart < hend;
11961193

11971194
if (type == FLUSH_TYPE_LOCAL) {
11981195
asm volatile("ptesync": : :"memory");

0 commit comments

Comments
 (0)