Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+5 -7
+5 -7
arch/s390/kernel/module.c
··· 495 495 const Elf_Shdr *s; 496 496 char *secstrings, *secname; 497 497 void *aseg; 498 - #ifdef CONFIG_FUNCTION_TRACER 499 - int ret; 500 - #endif 498 + int rc = 0; 501 499 502 500 if (IS_ENABLED(CONFIG_EXPOLINE) && 503 501 !nospec_disable && me->arch.plt_size) { ··· 527 529 528 530 #ifdef CONFIG_FUNCTION_TRACER 529 531 if (!strcmp(FTRACE_CALLSITE_SECTION, secname)) { 530 - ret = module_alloc_ftrace_hotpatch_trampolines(me, s); 531 - if (ret < 0) 532 - return ret; 532 + rc = module_alloc_ftrace_hotpatch_trampolines(me, s); 533 + if (rc) 534 + break; 533 535 } 534 536 #endif /* CONFIG_FUNCTION_TRACER */ 535 537 } 536 538 537 - return 0; 539 + return rc; 538 540 }