Skip to content

Commit 0cfaee2

Browse files
Qian Caitorvalds
authored andcommitted
include/asm-generic/5level-fixup.h: fix variable 'p4d' set but not used
A compiler throws a warning on an arm64 system since commit 9849a56 ("arch, mm: convert all architectures to use 5level-fixup.h"), mm/kasan/init.c: In function 'kasan_free_p4d': mm/kasan/init.c:344:9: warning: variable 'p4d' set but not used [-Wunused-but-set-variable] p4d_t *p4d; ^~~ because p4d_none() in "5level-fixup.h" is compiled away while it is a static inline function in "pgtable-nopud.h". However, if converted p4d_none() to a static inline there, powerpc would be unhappy as it reads those in assembler language in "arch/powerpc/include/asm/book3s/64/pgtable.h", so it needs to skip assembly include for the static inline C function. While at it, converted a few similar functions to be consistent with the ones in "pgtable-nopud.h". Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Qian Cai <[email protected]> Acked-by: Arnd Bergmann <[email protected]> Cc: Kirill A. Shutemov <[email protected]> Cc: Michal Hocko <[email protected]> Cc: Jason Gunthorpe <[email protected]> Signed-off-by: Andrew Morton <[email protected]> Signed-off-by: Linus Torvalds <[email protected]>
1 parent 6a2aeab commit 0cfaee2

File tree

1 file changed

+18
-3
lines changed

1 file changed

+18
-3
lines changed

include/asm-generic/5level-fixup.h

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,24 @@
1919

2020
#define p4d_alloc(mm, pgd, address) (pgd)
2121
#define p4d_offset(pgd, start) (pgd)
22-
#define p4d_none(p4d) 0
23-
#define p4d_bad(p4d) 0
24-
#define p4d_present(p4d) 1
22+
23+
#ifndef __ASSEMBLY__
24+
static inline int p4d_none(p4d_t p4d)
25+
{
26+
return 0;
27+
}
28+
29+
static inline int p4d_bad(p4d_t p4d)
30+
{
31+
return 0;
32+
}
33+
34+
static inline int p4d_present(p4d_t p4d)
35+
{
36+
return 1;
37+
}
38+
#endif
39+
2540
#define p4d_ERROR(p4d) do { } while (0)
2641
#define p4d_clear(p4d) pgd_clear(p4d)
2742
#define p4d_val(p4d) pgd_val(p4d)

0 commit comments

Comments
 (0)