Skip to content

Commit d240204

Browse files
nickdesaulnierspalmer-dabbelt
authored andcommitted
riscv: mm: fix 2 instances of -Wmissing-variable-declarations
I'm looking to enable -Wmissing-variable-declarations behind W=1. 0day bot spotted the following instance in ARCH=riscv builds: arch/riscv/mm/init.c:276:7: warning: no previous extern declaration for non-static variable 'trampoline_pg_dir' [-Wmissing-variable-declarations] 276 | pgd_t trampoline_pg_dir[PTRS_PER_PGD] __page_aligned_bss; | ^ arch/riscv/mm/init.c:276:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit 276 | pgd_t trampoline_pg_dir[PTRS_PER_PGD] __page_aligned_bss; | ^ arch/riscv/mm/init.c:279:7: warning: no previous extern declaration for non-static variable 'early_pg_dir' [-Wmissing-variable-declarations] 279 | pgd_t early_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); | ^ arch/riscv/mm/init.c:279:1: note: declare 'static' if the variable is not intended to be used outside of this translation unit 279 | pgd_t early_pg_dir[PTRS_PER_PGD] __initdata __aligned(PAGE_SIZE); | ^ These symbols are referenced by more than one translation unit, so make sure they're both declared and include the correct header for their declarations. Finally, sort the list of includes to help keep them tidy. Reported-by: kernel test robot <[email protected]> Closes: https://lore.kernel.org/llvm/[email protected]/ Signed-off-by: Nick Desaulniers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Cc: [email protected] Signed-off-by: Palmer Dabbelt <[email protected]>
1 parent 4eb2eb1 commit d240204

File tree

3 files changed

+7
-5
lines changed

3 files changed

+7
-5
lines changed

arch/riscv/include/asm/pgtable.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,8 @@ extern struct pt_alloc_ops pt_ops __initdata;
188188
#define PAGE_KERNEL_IO __pgprot(_PAGE_IOREMAP)
189189

190190
extern pgd_t swapper_pg_dir[];
191+
extern pgd_t trampoline_pg_dir[];
192+
extern pgd_t early_pg_dir[];
191193

192194
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
193195
static inline int pmd_present(pmd_t pmd)

arch/riscv/mm/init.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,13 @@
2626
#include <linux/kfence.h>
2727

2828
#include <asm/fixmap.h>
29-
#include <asm/tlbflush.h>
30-
#include <asm/sections.h>
31-
#include <asm/soc.h>
3229
#include <asm/io.h>
33-
#include <asm/ptdump.h>
3430
#include <asm/numa.h>
31+
#include <asm/pgtable.h>
32+
#include <asm/ptdump.h>
33+
#include <asm/sections.h>
34+
#include <asm/soc.h>
35+
#include <asm/tlbflush.h>
3536

3637
#include "../kernel/head.h"
3738

arch/riscv/mm/kasan_init.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
* region is not and then we have to go down to the PUD level.
2323
*/
2424

25-
extern pgd_t early_pg_dir[PTRS_PER_PGD];
2625
pgd_t tmp_pg_dir[PTRS_PER_PGD] __page_aligned_bss;
2726
p4d_t tmp_p4d[PTRS_PER_P4D] __page_aligned_bss;
2827
pud_t tmp_pud[PTRS_PER_PUD] __page_aligned_bss;

0 commit comments

Comments
 (0)