diff options
author | Masahiro Yamada <masahiroy@kernel.org> | 2022-04-05 13:33:52 +0200 |
---|---|---|
committer | Masahiro Yamada <masahiroy@kernel.org> | 2022-05-07 20:16:58 +0200 |
commit | 535b3e05f435698f8f661d9e6449beb5791fff59 (patch) | |
tree | 5c9194916c9045e6f68087e6b7217e2aeaceb47d /scripts/mod | |
parent | modpost: remove useless export_from_sec() (diff) | |
download | linux-535b3e05f435698f8f661d9e6449beb5791fff59.tar.xz linux-535b3e05f435698f8f661d9e6449beb5791fff59.zip |
modpost: move export_from_secname() call to more relevant place
The assigned 'export' is only used when
if (strstarts(symname, "__ksymtab_"))
is met. The else-part of the assignment is the dead code.
Move the export_from_secname() call to where it is used.
Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
Diffstat (limited to 'scripts/mod')
-rw-r--r-- | scripts/mod/modpost.c | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/scripts/mod/modpost.c b/scripts/mod/modpost.c index eebb32689816..f9e54247ae1d 100644 --- a/scripts/mod/modpost.c +++ b/scripts/mod/modpost.c @@ -684,14 +684,8 @@ static void handle_modversion(const struct module *mod, static void handle_symbol(struct module *mod, struct elf_info *info, const Elf_Sym *sym, const char *symname) { - enum export export; const char *name; - if (strstarts(symname, "__ksymtab")) - export = export_from_secname(info, get_secindex(info, sym)); - else - export = export_unknown; - switch (sym->st_shndx) { case SHN_COMMON: if (strstarts(symname, "__gnu_lto_")) { @@ -726,7 +720,11 @@ static void handle_symbol(struct module *mod, struct elf_info *info, default: /* All exported symbols */ if (strstarts(symname, "__ksymtab_")) { + enum export export; + name = symname + strlen("__ksymtab_"); + export = export_from_secname(info, + get_secindex(info, sym)); sym_add_exported(name, mod, export); } if (strcmp(symname, "init_module") == 0) |