Skip to contentSkip to conversation

Fix some build warnings when W=1

PATCH In review Zong Li 3 participants 6 messages Jul 16, 2020 RISC-V

lore
Share & tools
lore

Zong Li

author
#0 lore raw

v2 cover Fix some build warnings when W=1

These patches fix some build warnings when W=1, the most of warnings are missing prototype as follows:

arch/riscv/mm/init.c:520:13: warning: no previous prototype for 'resource_init' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:130:5: warning: no previous prototype for 'set_memory_ro' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:136:5: warning: no previous prototype for 'set_memory_rw' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:142:5: warning: no previous prototype for 'set_memory_x' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:147:5: warning: no previous prototype for 'set_memory_nx' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:152:5: warning: no previous prototype for 'set_direct_map_invalid_noflush' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:169:5: warning: no previous prototype for 'set_direct_map_default_noflush' [-Wmissing-prototypes] arch/riscv/mm/pageattr.c:97:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]

Changed in v2:
- Modify the patch description

Zong Li (2):
riscv: Fix build warning for mm/init
riscv: Fix build warning for mm/pageattr

 arch/riscv/mm/init.c     | 2 +-
 arch/riscv/mm/pageattr.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Signature · 1 line
2.27.0
author
#1 lore raw

PATCH v2 1/2 riscv: Fix build warning for mm/init

Add static keyword for resource_init, this function is only used in this object file.

The warning message as follow (with W=1 build):

arch/riscv/mm/init.c:520:13:
warning: no previous prototype for 'resource_init' [-Wmissing-prototypes]

---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +1 -1
index 92002952c621..66f5952f39c0 100644
@@ -517,7 +517,7 @@ void mark_rodata_ro(void)
 }
 #endif
 
-void __init resource_init(void)
+static void __init resource_init(void)
 {
 	struct memblock_region *region;
 
Signature · 1 line
2.27.0
Reviewed-by on v2 1/2
#2 lore raw

Re: [PATCH v2 1/2] riscv: Fix build warning for mm/init

Quoted 10 lines · Zong Li

Add static keyword for resource_init, this function is only used in this object file.

The warning message as follow (with W=1 build):

arch/riscv/mm/init.c:520:13:
warning: no previous prototype for 'resource_init' [-Wmissing-prototypes]

- Pekka

Reviewed-by on v2 1/2
#3 lore raw

Re: [PATCH v2 1/2] riscv: Fix build warning for mm/init

In reply to Zong Li
Quoted 28 lines · Zong Li

Add static keyword for resource_init, this function is only used in this object file.

The warning message as follow (with W=1 build):

arch/riscv/mm/init.c:520:13:
warning: no previous prototype for 'resource_init' [-Wmissing-prototypes]

---
 arch/riscv/mm/init.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/riscv/mm/init.c +1 -2
index 92002952c621..66f5952f39c0 100644
@@ -517,7 +517,7 @@ void mark_rodata_ro(void)
 }
 #endif
 
-void __init resource_init(void)
+static void __init resource_init(void)
 {
        struct memblock_region *region;
 
--
Quoted 2 lines

2.27.0

Looks good to me.

Regards,
Anup

author
#4 lore raw

PATCH v2 2/2 riscv: Fix build warning for mm/pageattr

In reply to Zong Li

Add header for missing prototype. Also, static keyword should be at beginning of declaration.

The warning messages as follows (with W=1 build):

arch/riscv/mm/pageattr.c:130:5:
warning: no previous prototype for 'set_memory_ro' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:136:5:
warning: no previous prototype for 'set_memory_rw' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:142:5:
warning: no previous prototype for 'set_memory_x' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:147:5:
warning: no previous prototype for 'set_memory_nx' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:152:5:
warning: no previous prototype for 'set_direct_map_invalid_noflush' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:169:5:
warning: no previous prototype for 'set_direct_map_default_noflush' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:97:1:
warning: 'static' is not at beginning of declaration [-Wold-style-declaration]

---
 arch/riscv/mm/pageattr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/pageattr.c +2 -1
index 289a9a5ea5b5..19fecb362d81 100644
@@ -7,6 +7,7 @@
 #include <linux/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/bitops.h>
+#include <asm/set_memory.h>
 
 struct pageattr_masks {
 	pgprot_t set_mask;
@@ -94,7 +95,7 @@ static int pageattr_pte_hole(unsigned long addr, unsigned long next,
 	return 0;
 }
 
-const static struct mm_walk_ops pageattr_ops = {
+static const struct mm_walk_ops pageattr_ops = {
 	.pgd_entry = pageattr_pgd_entry,
 	.p4d_entry = pageattr_p4d_entry,
 	.pud_entry = pageattr_pud_entry,
Signature · 7 lines
2.27.0


_______________________________________________
linux-riscv mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-riscv
Reviewed-by on v2 2/2
#5 lore raw

Re: [PATCH v2 2/2] riscv: Fix build warning for mm/pageattr

Quoted 55 lines · Zong Li

Add header for missing prototype. Also, static keyword should be at beginning of declaration.

The warning messages as follows (with W=1 build):

arch/riscv/mm/pageattr.c:130:5:
warning: no previous prototype for 'set_memory_ro' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:136:5:
warning: no previous prototype for 'set_memory_rw' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:142:5:
warning: no previous prototype for 'set_memory_x' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:147:5:
warning: no previous prototype for 'set_memory_nx' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:152:5:
warning: no previous prototype for 'set_direct_map_invalid_noflush' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:169:5:
warning: no previous prototype for 'set_direct_map_default_noflush' [-Wmissing-prototypes]

arch/riscv/mm/pageattr.c:97:1:
warning: 'static' is not at beginning of declaration [-Wold-style-declaration]

---
 arch/riscv/mm/pageattr.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
arch/riscv/mm/pageattr.c +2 -2
index 289a9a5ea5b5..19fecb362d81 100644
@@ -7,6 +7,7 @@
 #include <linux/pgtable.h>
 #include <asm/tlbflush.h>
 #include <asm/bitops.h>
+#include <asm/set_memory.h>
 
 struct pageattr_masks {
        pgprot_t set_mask;
@@ -94,7 +95,7 @@ static int pageattr_pte_hole(unsigned long addr, unsigned long next,
        return 0;
 }
 
-const static struct mm_walk_ops pageattr_ops = {
+static const struct mm_walk_ops pageattr_ops = {
        .pgd_entry = pageattr_pgd_entry,
        .p4d_entry = pageattr_p4d_entry,
        .pud_entry = pageattr_pud_entry,
--
Quoted 2 lines

2.27.0

Looks good to me.

Regards,
Anup