* [PATCH] tools/objtool: Fix unnecessary jumps
@ 2020-08-10 4:06 Youling Tang
2020-08-10 12:57 ` Kamalesh Babulal
0 siblings, 1 reply; 3+ messages in thread
From: Youling Tang @ 2020-08-10 4:06 UTC (permalink / raw)
To: Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel
There is no need to jump to the "out" tag when "ret < 0", just return
directly to "ret".
Signed-off-by: Youling Tang <tangyouling@loongson.cn>
---
tools/objtool/check.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/tools/objtool/check.c b/tools/objtool/check.c
index e034a8f..94b166d 100644
--- a/tools/objtool/check.c
+++ b/tools/objtool/check.c
@@ -2799,7 +2799,7 @@ 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))
@@ -2808,7 +2808,7 @@ int check(const char *_objname, bool orc)
if (vmlinux && !validate_dup) {
ret = validate_vmlinux_functions(&file);
if (ret < 0)
- goto out;
+ return ret;
warnings += ret;
goto out;
@@ -2823,35 +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;
+ return ret;
}
out:
--
2.1.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/objtool: Fix unnecessary jumps
2020-08-10 4:06 [PATCH] tools/objtool: Fix unnecessary jumps Youling Tang
@ 2020-08-10 12:57 ` Kamalesh Babulal
2020-08-11 2:18 ` Youling Tang
0 siblings, 1 reply; 3+ messages in thread
From: Kamalesh Babulal @ 2020-08-10 12:57 UTC (permalink / raw)
To: Youling Tang, Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel
On 10/08/20 9:36 am, Youling Tang wrote:
> There is no need to jump to the "out" tag when "ret < 0", just return
> directly to "ret".
>
> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
> ---
> tools/objtool/check.c | 16 ++++++++--------
> 1 file changed, 8 insertions(+), 8 deletions(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index e034a8f..94b166d 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
[snip]
>
> if (file.elf->changed) {
> ret = elf_write(file.elf);
> if (ret < 0)
> - goto out;
> + return ret;
> }
>
> out:
the out label code is no more required with this change, so remove
it and return 0 for warnings for now. 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.
--
Kamalesh
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tools/objtool: Fix unnecessary jumps
2020-08-10 12:57 ` Kamalesh Babulal
@ 2020-08-11 2:18 ` Youling Tang
0 siblings, 0 replies; 3+ messages in thread
From: Youling Tang @ 2020-08-11 2:18 UTC (permalink / raw)
To: Kamalesh Babulal, Josh Poimboeuf, Peter Zijlstra; +Cc: linux-kernel
Thank you for your reply and suggestions, I will remove
the "out" label code.
Thanks,
Youling
On 08/10/2020 08:57 PM, Kamalesh Babulal wrote:
> On 10/08/20 9:36 am, Youling Tang wrote:
>> There is no need to jump to the "out" tag when "ret < 0", just return
>> directly to "ret".
>>
>> Signed-off-by: Youling Tang <tangyouling@loongson.cn>
>> ---
>> tools/objtool/check.c | 16 ++++++++--------
>> 1 file changed, 8 insertions(+), 8 deletions(-)
>>
>> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
>> index e034a8f..94b166d 100644
>> --- a/tools/objtool/check.c
>> +++ b/tools/objtool/check.c
> [snip]
>
>> if (file.elf->changed) {
>> ret = elf_write(file.elf);
>> if (ret < 0)
>> - goto out;
>> + return ret;
>> }
>>
>> out:
> the out label code is no more required with this change, so remove
> it and return 0 for warnings for now. 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.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-11 2:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 4:06 [PATCH] tools/objtool: Fix unnecessary jumps Youling Tang
2020-08-10 12:57 ` Kamalesh Babulal
2020-08-11 2:18 ` Youling Tang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).