summaryrefslogtreecommitdiff
path: root/tools/objtool/special.c
diff options
context:
space:
mode:
authorJosh Poimboeuf <jpoimboe@kernel.org>2025-09-17 09:03:24 -0700
committerJosh Poimboeuf <jpoimboe@kernel.org>2025-10-14 14:45:23 -0700
commit4ac2ba35f62d330dfb2f3148cc7405a6ce5dfa2d (patch)
treea458da5123acbe1fae7fde2589f096b0f110935e /tools/objtool/special.c
parent2bb23cbf3f21919ba17cf63404ec0224bd8bf4fb (diff)
objtool: Remove error handling boilerplate
Up to a certain point in objtool's execution, all errors are fatal and return -1. When propagating such errors, just return -1 directly instead of trying to propagate the original return code. This helps make the code more compact and the behavior more explicit. Acked-by: Petr Mladek <pmladek@suse.com> Tested-by: Joe Lawrence <joe.lawrence@redhat.com> Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
Diffstat (limited to 'tools/objtool/special.c')
-rw-r--r--tools/objtool/special.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/objtool/special.c b/tools/objtool/special.c
index c80fed8a840e..c0beefb93b62 100644
--- a/tools/objtool/special.c
+++ b/tools/objtool/special.c
@@ -133,7 +133,7 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
struct section *sec;
unsigned int nr_entries;
struct special_alt *alt;
- int idx, ret;
+ int idx;
INIT_LIST_HEAD(alts);
@@ -157,11 +157,8 @@ int special_get_alts(struct elf *elf, struct list_head *alts)
}
memset(alt, 0, sizeof(*alt));
- ret = get_alt_entry(elf, entry, sec, idx, alt);
- if (ret > 0)
- continue;
- if (ret < 0)
- return ret;
+ if (get_alt_entry(elf, entry, sec, idx, alt))
+ return -1;
list_add_tail(&alt->list, alts);
}