diff mbox series

[3/7] modpost: add table_size local variable to symsearch_find_nearest()

Message ID 20231101150404.754108-4-masahiroy@kernel.org (mailing list archive)
State New, archived
Headers show
Series modpost: fix modpost errors for m68k-uclinux-gcc | expand

Commit Message

Masahiro Yamada Nov. 1, 2023, 3:04 p.m. UTC
Keep consistency with 'table', and make the conditional part slightly
shorter.

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
---

 scripts/mod/symsearch.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/scripts/mod/symsearch.c b/scripts/mod/symsearch.c
index 00f0f9c354db..97566aee0979 100644
--- a/scripts/mod/symsearch.c
+++ b/scripts/mod/symsearch.c
@@ -154,9 +154,10 @@  Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
 				unsigned int secndx, bool allow_negative,
 				Elf_Addr min_distance)
 {
-	unsigned int hi = elf->symsearch->table_size;
-	unsigned int lo = 0;
 	const struct syminfo *table = elf->symsearch->table;
+	unsigned int table_size = elf->symsearch->table_size;
+	unsigned int hi = table_size;
+	unsigned int lo = 0;
 	struct syminfo target;
 
 	target.addr = addr;
@@ -183,8 +184,7 @@  Elf_Sym *symsearch_find_nearest(struct elf_info *elf, Elf_Addr addr,
 	 */
 	Elf_Sym *result = NULL;
 
-	if (allow_negative &&
-	    hi < elf->symsearch->table_size &&
+	if (allow_negative && hi < table_size &&
 	    table[hi].section_index == secndx &&
 	    table[hi].addr - addr <= min_distance) {
 		min_distance = table[hi].addr - addr;