Skip to content

Commit 7390b94

Browse files
masahir0ymcgrof
authored andcommitted
module: merge check_exported_symbol() into find_exported_symbol_in_section()
Now check_exported_symbol() always succeeds. Merge it into find_exported_symbol_in_search() to make the code concise. Signed-off-by: Masahiro Yamada <[email protected]> Signed-off-by: Luis Chamberlain <[email protected]>
1 parent cdd66eb commit 7390b94

File tree

1 file changed

+7
-15
lines changed

1 file changed

+7
-15
lines changed

kernel/module/main.c

Lines changed: 7 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -243,17 +243,6 @@ static __maybe_unused void *any_section_objs(const struct load_info *info,
243243
#define symversion(base, idx) ((base != NULL) ? ((base) + (idx)) : NULL)
244244
#endif
245245

246-
static bool check_exported_symbol(const struct symsearch *syms,
247-
struct module *owner, unsigned int symnum,
248-
struct find_symbol_arg *fsa)
249-
{
250-
fsa->owner = owner;
251-
fsa->crc = symversion(syms->crcs, symnum);
252-
fsa->sym = &syms->start[symnum];
253-
fsa->license = syms->license;
254-
return true;
255-
}
256-
257246
static const char *kernel_symbol_name(const struct kernel_symbol *sym)
258247
{
259248
#ifdef CONFIG_HAVE_ARCH_PREL32_RELOCATIONS
@@ -290,12 +279,15 @@ static bool find_exported_symbol_in_section(const struct symsearch *syms,
290279

291280
sym = bsearch(fsa->name, syms->start, syms->stop - syms->start,
292281
sizeof(struct kernel_symbol), cmp_name);
282+
if (!sym)
283+
return false;
293284

294-
if (sym != NULL && check_exported_symbol(syms, owner,
295-
sym - syms->start, fsa))
296-
return true;
285+
fsa->owner = owner;
286+
fsa->crc = symversion(syms->crcs, sym - syms->start);
287+
fsa->sym = sym;
288+
fsa->license = syms->license;
297289

298-
return false;
290+
return true;
299291
}
300292

301293
/*

0 commit comments

Comments
 (0)