s390/modules: Simplify module_finalize() slightly

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>
This commit is contained in:
Heiko Carstens
2025-11-17 15:09:52 +01:00
parent c3d17464f0
commit 1d7764cfe3

View File

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