From f43e9daace4efc146aa653179bdebb478be5de8a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 4 Feb 2019 10:53:16 +0900 Subject: kallsyms: add static qualifiers where missing Fix the following sparse warnings: scripts/kallsyms.c:65:5: warning: symbol 'token_profit' was not declared. Should it be static? scripts/kallsyms.c:68:15: warning: symbol 'best_table' was not declared. Should it be static? scripts/kallsyms.c:69:15: warning: symbol 'best_table_len' was not declared. Should it be static? Also, remove 'inline' from is_arm_mapping_symbol(). The compiler will inline it anyway when it is appropriate to do so. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'scripts/kallsyms.c') diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index 77cebad0474e..fc00bb01faf0 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -62,11 +62,11 @@ static int all_symbols = 0; static int absolute_percpu = 0; static int base_relative = 0; -int token_profit[0x10000]; +static int token_profit[0x10000]; /* the table that holds the result of the compression */ -unsigned char best_table[256][2]; -unsigned char best_table_len[256]; +static unsigned char best_table[256][2]; +static unsigned char best_table_len[256]; static void usage(void) @@ -80,7 +80,7 @@ static void usage(void) * This ignores the intensely annoying "mapping symbols" found * in ARM ELF files: $a, $t and $d. */ -static inline int is_arm_mapping_symbol(const char *str) +static int is_arm_mapping_symbol(const char *str) { return str[0] == '$' && strchr("axtd", str[1]) && (str[2] == '\0' || str[2] == '.'); -- cgit v1.2.3-59-g8ed1b From 52a849ed8896d733de6005993f34407f7512311a Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 4 Feb 2019 10:53:17 +0900 Subject: kallsyms: remove unneeded memset() calls Global variables in the .bss section are zeroed out before the program starts to run. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 3 --- 1 file changed, 3 deletions(-) (limited to 'scripts/kallsyms.c') diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index fc00bb01faf0..f1b57492adef 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -596,9 +596,6 @@ static void insert_real_symbols_in_table(void) { unsigned int i, j, c; - memset(best_table, 0, sizeof(best_table)); - memset(best_table_len, 0, sizeof(best_table_len)); - for (i = 0; i < table_cnt; i++) { for (j = 0; j < table[i].len; j++) { c = table[i].sym[j]; -- cgit v1.2.3-59-g8ed1b From 500193ec57fddf5e52d64fd7278b37a6afc9f773 Mon Sep 17 00:00:00 2001 From: Masahiro Yamada Date: Mon, 4 Feb 2019 10:53:18 +0900 Subject: kallsyms: include instead of is enough to include the definition of BITS_PER_LONG. Signed-off-by: Masahiro Yamada --- scripts/kallsyms.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts/kallsyms.c') diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index f1b57492adef..03ff265fe522 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c @@ -331,7 +331,7 @@ static void write_src(void) unsigned int *markers; char buf[KSYM_NAME_LEN]; - printf("#include \n"); + printf("#include \n"); printf("#if BITS_PER_LONG == 64\n"); printf("#define PTR .quad\n"); printf("#define ALGN .balign 8\n"); -- cgit v1.2.3-59-g8ed1b