Skip to content

Commit 1d7764c

Browse files
committed
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>
1 parent c3d1746 commit 1d7764c

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

arch/s390/kernel/module.c

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -495,9 +495,7 @@ int module_finalize(const Elf_Ehdr *hdr,
495495
const Elf_Shdr *s;
496496
char *secstrings, *secname;
497497
void *aseg;
498-
#ifdef CONFIG_FUNCTION_TRACER
499-
int ret;
500-
#endif
498+
int rc = 0;
501499

502500
if (IS_ENABLED(CONFIG_EXPOLINE) &&
503501
!nospec_disable && me->arch.plt_size) {
@@ -529,12 +527,12 @@ int module_finalize(const Elf_Ehdr *hdr,
529527

530528
#ifdef CONFIG_FUNCTION_TRACER
531529
if (!strcmp(FTRACE_CALLSITE_SECTION, secname)) {
532-
ret = module_alloc_ftrace_hotpatch_trampolines(me, s);
533-
if (ret < 0)
534-
return ret;
530+
rc = module_alloc_ftrace_hotpatch_trampolines(me, s);
531+
if (rc)
532+
break;
535533
}
536534
#endif /* CONFIG_FUNCTION_TRACER */
537535
}
538536

539-
return 0;
537+
return rc;
540538
}

0 commit comments

Comments
 (0)