lkml.org 
[lkml]   [2020]   [Aug]   [11]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH v3] tools/objtool: Fix unnecessary jumps
Date
Previously cleanup() function was called under the out label for both
fatal errors (ret < 0) and warnings. Now that cleanup() function is
removed, the out label is no longer required. Remove it and return
immediately for the fatal errors with ret as return code and 0 for
warnings.

Signed-off-by: Youling Tang <tangyouling@loongson.cn>
Reviewed-by: Kamalesh Babulal <kamalesh@linux.vnet.ibm.com>
---
tools/objtool/check.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)

diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e034a8f..b9bfcb5 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2799,19 +2799,19 @@ int check(const char *_objname, bool orc)

ret = decode_sections(&file);
if (ret < 0)
- goto out;
+ return ret;
warnings += ret;

if (list_empty(&file.insn_list))
- goto out;
+ return ret;

if (vmlinux && !validate_dup) {
ret = validate_vmlinux_functions(&file);
if (ret < 0)
- goto out;
+ return ret;

warnings += ret;
- goto out;
+ return 0;
}

if (retpoline) {
@@ -2823,45 +2823,35 @@ int check(const char *_objname, bool orc)

ret = validate_functions(&file);
if (ret < 0)
- goto out;
+ return ret;
warnings += ret;

ret = validate_unwind_hints(&file, NULL);
if (ret < 0)
- goto out;
+ return ret;
warnings += ret;

if (!warnings) {
ret = validate_reachable_instructions(&file);
if (ret < 0)
- goto out;
+ return ret;
warnings += ret;
}

if (orc) {
ret = create_orc(&file);
if (ret < 0)
- goto out;
+ return ret;

ret = create_orc_sections(&file);
if (ret < 0)
- goto out;
+ return ret;
}

if (file.elf->changed) {
ret = elf_write(file.elf);
if (ret < 0)
- goto out;
- }
-
-out:
- if (ret < 0) {
- /*
- * Fatal error. The binary is corrupt or otherwise broken in
- * some way, or objtool itself is broken. Fail the kernel
- * build.
- */
- return ret;
+ return ret;
}

return 0;
--
2.1.0
\
 
 \ /
  Last update: 2020-08-12 03:14    [W:0.029 / U:0.580 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site