ARM: decompressor: fix warning introduced in fortify patch
authorRussell King <rmk+kernel@armlinux.org.uk>
Thu, 29 Mar 2018 10:59:17 +0000 (11:59 +0100)
committerRussell King <rmk+kernel@armlinux.org.uk>
Thu, 5 Apr 2018 22:56:40 +0000 (23:56 +0100)
Commit ee333554fed5 ("ARM: 8749/1: Kconfig: Add ARCH_HAS_FORTIFY_SOURCE")
introduced a new warning:

arch/arm/boot/compressed/misc.c: In function 'fortify_panic':
arch/arm/boot/compressed/misc.c:167:1: error: 'noreturn' function does return [-Werror]

The simple solution would be to make 'error' a noreturn function, but
this causes a prototype mismatch as the function is prototyped in
several .c files.  So, move the function prototype to a new header.

There are also a couple of variables that are also declared in several
locations.  Clean this up while we are here.

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
arch/arm/boot/compressed/decompress.c
arch/arm/boot/compressed/misc.c
arch/arm/boot/compressed/misc.h [new file with mode: 0644]

index a2ac3fe7dbf8ab4e355e0ce43147d0fd689d6ebe..c16c1829a5e4f8732033ea18c5de327aa2eb2878 100644 (file)
@@ -6,10 +6,7 @@
 #include <linux/stddef.h>      /* for NULL */
 #include <linux/linkage.h>
 #include <asm/string.h>
-
-extern unsigned long free_mem_ptr;
-extern unsigned long free_mem_end_ptr;
-extern void error(char *);
+#include "misc.h"
 
 #define STATIC static
 #define STATIC_RW_DATA /* non-static please */
index 4a247acd1b96818d762e5042edb0f30ec5db11bf..79f56c5a9fe5721a13ddbfbc6b88b6ec1640d24b 100644 (file)
@@ -22,9 +22,9 @@ unsigned int __machine_arch_type;
 #include <linux/compiler.h>    /* for inline */
 #include <linux/types.h>
 #include <linux/linkage.h>
+#include "misc.h"
 
 static void putstr(const char *ptr);
-extern void error(char *x);
 
 #include CONFIG_UNCOMPRESS_INCLUDE
 
diff --git a/arch/arm/boot/compressed/misc.h b/arch/arm/boot/compressed/misc.h
new file mode 100644 (file)
index 0000000..c958dcc
--- /dev/null
@@ -0,0 +1,10 @@
+#ifndef MISC_H
+#define MISC_H
+
+#include <linux/compiler.h>
+
+void error(char *x) __noreturn;
+extern unsigned long free_mem_ptr;
+extern unsigned long free_mem_end_ptr;
+
+#endif