x86/purgatory: Fix sparse warning, symbol not declared
v4 cover x86/purgatory: Fix sparse warning, symbol not declared
Sparse emits several 'symbol not declared' warnings for various functions and variables.
Add static keyword to functions and variables which have file scope only.
Add header file with funciton declaration. Add preprocessor guard and include header in ASM file. Include header in C file contianing function definition.
Changes since v3:
- Put preprocessor directives in correct order.
Changes since v2:
- Add preprocessor guard.
Changes since v1:
- Add header file.
Tobin C. Harding (2):
x86/purgatory: Fix sparse warning, symbol not declared x86/purgatory: Fix sparse warning, symbol not declared
arch/x86/purgatory/purgatory.c | 11 ++++++----- arch/x86/purgatory/purgatory.h | 12 ++++++++++++ arch/x86/purgatory/setup-x86_64.S | 4 ++-- 3 files changed, 20 insertions(+), 7 deletions(-) create mode 100644 arch/x86/purgatory/purgatory.h
Signature · 1 line
2.7.4
PATCH v4 1/2 x86/purgatory: Fix sparse warning, symbol not declared
Sparse emits several 'symbol not declared' warnings for various functions and variables.
Add static keyword to functions and variables which have file scope only.
--- arch/x86/purgatory/purgatory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/purgatory/purgatory.c +5 -5
@@ -18,11 +18,11 @@ struct sha_region {unsigned long len; }; -unsigned long backup_dest =0 ; -unsigned long backup_src =0 ; -unsigned long backup_sz =0 ; +static unsigned long backup_dest; +static unsigned long backup_src; +static unsigned long backup_sz; -u8 sha256_digest[SHA256_DIGEST_SIZE ] = {0 }; +static u8 sha256_digest[SHA256_DIGEST_SIZE ] = {0 };struct sha_region sha_regions[16 ] = {};
@@ -39,7 +39,7 @@ static int copy_backup_region(void)return 0 ; } -int verify_sha256_digest (void ) +static int verify_sha256_digest (void ) {struct sha_region *ptr, *end;u8 digest[SHA256_DIGEST_SIZE ];
Signature · 1 line
2.7.4
tip-bot for Tobin C. Harding
merge bot[tip:x86/urgent] x86/purgatory: Make functions and variables static
x86/purgatory: Make functions and variables static
Commit-ID: 72042a8c7b01048a36ece216aaf206b7d60ca661 Gitweb: http://git.kernel.org/tip/72042a8c7b01048a36ece216aaf206b7d60ca661 Author: Tobin C. Harding <[email protected]> AuthorDate: Mon, 20 Feb 2017 10:12:35 +1100 Committer: Thomas Gleixner <[email protected]> CommitDate: Wed, 1 Mar 2017 11:27:26 +0100
x86/purgatory: Make functions and variables static
Sparse emits several 'symbol not declared' warnings for various functions and variables.
Add static keyword to functions and variables which have file scope only.
--- arch/x86/purgatory/purgatory.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
arch/x86/purgatory/purgatory.c +5 -5
@@ -18,11 +18,11 @@ struct sha_region {unsigned long len; }; -unsigned long backup_dest =0 ; -unsigned long backup_src =0 ; -unsigned long backup_sz =0 ; +static unsigned long backup_dest; +static unsigned long backup_src; +static unsigned long backup_sz; -u8 sha256_digest[SHA256_DIGEST_SIZE ] = {0 }; +static u8 sha256_digest[SHA256_DIGEST_SIZE ] = {0 };struct sha_region sha_regions[16 ] = {};
@@ -39,7 +39,7 @@ static int copy_backup_region(void)return 0 ; } -int verify_sha256_digest (void ) +static int verify_sha256_digest (void ) {struct sha_region *ptr, *end;u8 digest[SHA256_DIGEST_SIZE ];
PATCH v4 2/2 x86/purgatory: Fix sparse warning, symbol not declared
In reply to Tobin C. HardingSparse emits warning, 'symbol not declared' for a function that has neither file scope nor a forward declaration. The functions only call site is an ASM file.
Add a header file with the function declaration. Include the header file in the C source file defining the function in order to fix the sparse warning. Include the header file in ASM file containing the call site to document the usage.
--- arch/x86/purgatory/purgatory.c | 1 + arch/x86/purgatory/purgatory.h | 12 ++++++++++++ arch/x86/purgatory/setup-x86_64.S | 4 ++-- 3 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 arch/x86/purgatory/purgatory.h
arch/x86/purgatory/purgatory.c +1 -0
@@ -11,6 +11,7 @@*/ #include "sha256.h" +#include "purgatory.h" #include "../boot/string.h" struct sha_region {
arch/x86/purgatory/purgatory.h new file +12 -0
@@ -0,0 +1,12 @@ +#ifndef PURGATORY_H +#define PURGATORY_H + +#ifndef __ASSEMBLY__ + +extern void purgatory (void ); + +#endif /* __ASSEMBLY__ */ + +#endif /* PURGATORY_H */ + +
arch/x86/purgatory/setup-x86_64.S +2 -2
@@ -9,8 +9,8 @@ * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ - - .text +#include "purgatory.h" + .text .globl purgatory_start .balign 16 purgatory_start:
Signature · 1 line
2.7.4
tip-bot for Tobin C. Harding
merge botx86/purgatory: Fix sparse warning, symbol not declared
Commit-ID: e98fe5127b9cc8ab33d1094b81c19deb1f9082bf Gitweb: http://git.kernel.org/tip/e98fe5127b9cc8ab33d1094b81c19deb1f9082bf Author: Tobin C. Harding <[email protected]> AuthorDate: Mon, 20 Feb 2017 10:12:36 +1100 Committer: Thomas Gleixner <[email protected]> CommitDate: Wed, 1 Mar 2017 11:27:26 +0100
x86/purgatory: Fix sparse warning, symbol not declared
Sparse emits warning, 'symbol not declared' for a function that has neither file scope nor a forward declaration. The functions only call site is an ASM file.
Add a header file with the function declaration. Include the header file in the C source file defining the function in order to fix the sparse warning. Include the header file in ASM file containing the call site to document the usage.
--- arch/x86/purgatory/purgatory.c | 1 + arch/x86/purgatory/purgatory.h | 8 ++++++++ arch/x86/purgatory/setup-x86_64.S | 1 + 3 files changed, 10 insertions(+)
arch/x86/purgatory/purgatory.c +1 -0
@@ -11,6 +11,7 @@*/ #include "sha256.h" +#include "purgatory.h" #include "../boot/string.h" struct sha_region {
arch/x86/purgatory/purgatory.h new file +8 -0
@@ -0,0 +1,8 @@ +#ifndef PURGATORY_H +#define PURGATORY_H + +#ifndef __ASSEMBLY__ +extern void purgatory (void ); +#endif /* __ASSEMBLY__ */ + +#endif /* PURGATORY_H */
arch/x86/purgatory/setup-x86_64.S +1 -0
@@ -9,6 +9,7 @@ * This source code is licensed under the GNU General Public License, * Version 2. See the file COPYING for more details. */ +#include "purgatory.h" .text .globl purgatory_start