]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/modules: Simplify module_finalize() slightly
authorHeiko Carstens <hca@linux.ibm.com>
Mon, 17 Nov 2025 14:09:52 +0000 (15:09 +0100)
committerHeiko Carstens <hca@linux.ibm.com>
Mon, 24 Nov 2025 10:45:21 +0000 (11:45 +0100)
Preinitialize the return value, and break out the for loop in
module_finalize() in case of an error to get rid of an ifdef.

This makes it easier to add additional code, which may also depend
on config options.

Reviewed-by: Sven Schnelle <svens@linux.ibm.com>
Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
arch/s390/kernel/module.c

index 91e207b503943aa8f9486852c723721ea585d7eb..54d99e811a8374a745506b12a062c71def39ddf3 100644 (file)
@@ -495,9 +495,7 @@ int module_finalize(const Elf_Ehdr *hdr,
        const Elf_Shdr *s;
        char *secstrings, *secname;
        void *aseg;
-#ifdef CONFIG_FUNCTION_TRACER
-       int ret;
-#endif
+       int rc = 0;
 
        if (IS_ENABLED(CONFIG_EXPOLINE) &&
            !nospec_disable && me->arch.plt_size) {
@@ -529,12 +527,12 @@ int module_finalize(const Elf_Ehdr *hdr,
 
 #ifdef CONFIG_FUNCTION_TRACER
                if (!strcmp(FTRACE_CALLSITE_SECTION, secname)) {
-                       ret = module_alloc_ftrace_hotpatch_trampolines(me, s);
-                       if (ret < 0)
-                               return ret;
+                       rc = module_alloc_ftrace_hotpatch_trampolines(me, s);
+                       if (rc)
+                               break;
                }
 #endif /* CONFIG_FUNCTION_TRACER */
        }
 
-       return 0;
+       return rc;
 }