modpost: retrieve the module dependency and CRCs in check_exports()
authorMasahiro Yamada <masahiroy@kernel.org>
Sun, 24 Apr 2022 19:07:49 +0000 (04:07 +0900)
committerMasahiro Yamada <masahiroy@kernel.org>
Sat, 7 May 2022 18:16:59 +0000 (03:16 +0900)
Do not repeat the similar code.

It is simpler to do this in check_exports() instead of add_versions().

Signed-off-by: Masahiro Yamada <masahiroy@kernel.org>
Reviewed-by: Nick Desaulniers <ndesaulniers@google.com>
scripts/mod/modpost.c

index 969a081dba622ad8d247d7b7eac465ea1a49aa41..f9cbb6b6b7a5069f28dad102e49f0aca4e53a2c1 100644 (file)
@@ -2159,6 +2159,11 @@ static void check_exports(struct module *mod)
                              s->name, mod->name);
                        continue;
                }
+
+               s->module = exp->module;
+               s->crc_valid = exp->crc_valid;
+               s->crc = exp->crc;
+
                basename = strrchr(mod->name, '/');
                if (basename)
                        basename++;
@@ -2251,16 +2256,7 @@ static void add_staging_flag(struct buffer *b, const char *name)
  **/
 static void add_versions(struct buffer *b, struct module *mod)
 {
-       struct symbol *s, *exp;
-
-       for (s = mod->unres; s; s = s->next) {
-               exp = find_symbol(s->name);
-               if (!exp || exp->module == mod)
-                       continue;
-               s->module = exp->module;
-               s->crc_valid = exp->crc_valid;
-               s->crc = exp->crc;
-       }
+       struct symbol *s;
 
        if (!modversions)
                return;