* [PATCH] x86/unwind/orc: Use swap() instead of open coding it
@ 2023-03-30 2:00 Jiapeng Chong
2023-05-18 11:08 ` [tip: objtool/core] " tip-bot2 for Jiapeng Chong
0 siblings, 1 reply; 3+ messages in thread
From: Jiapeng Chong @ 2023-03-30 2:00 UTC (permalink / raw)
To: jpoimboe
Cc: peterz, tglx, mingo, bp, dave.hansen, x86, hpa, linux-kernel,
Jiapeng Chong, Abaci Robot
Swap is a function interface that provides exchange function. To avoid
code duplication, we can use swap function.
./arch/x86/kernel/unwind_orc.c:235:16-17: WARNING opportunity for swap().
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4641
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
arch/x86/kernel/unwind_orc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index 3ac50b7298d1..5fbcb229f707 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -219,7 +219,6 @@ static struct orc_entry *cur_orc_table = __start_orc_unwind;
static void orc_sort_swap(void *_a, void *_b, int size)
{
struct orc_entry *orc_a, *orc_b;
- struct orc_entry orc_tmp;
int *a = _a, *b = _b, tmp;
int delta = _b - _a;
@@ -231,9 +230,7 @@ static void orc_sort_swap(void *_a, void *_b, int size)
/* Swap the corresponding .orc_unwind entries: */
orc_a = cur_orc_table + (a - cur_orc_ip_table);
orc_b = cur_orc_table + (b - cur_orc_ip_table);
- orc_tmp = *orc_a;
- *orc_a = *orc_b;
- *orc_b = orc_tmp;
+ swap(*orc_a, *orc_b);
}
static int orc_sort_cmp(const void *_a, const void *_b)
--
2.20.1.7.g153144c
^ permalink raw reply [flat|nested] 3+ messages in thread* [tip: objtool/core] x86/unwind/orc: Use swap() instead of open coding it
2023-03-30 2:00 [PATCH] x86/unwind/orc: Use swap() instead of open coding it Jiapeng Chong
@ 2023-05-18 11:08 ` tip-bot2 for Jiapeng Chong
0 siblings, 0 replies; 3+ messages in thread
From: tip-bot2 for Jiapeng Chong @ 2023-05-18 11:08 UTC (permalink / raw)
To: linux-tip-commits
Cc: Abaci Robot, Jiapeng Chong, Josh Poimboeuf, x86, linux-kernel
The following commit has been merged into the objtool/core branch of tip:
Commit-ID: 95f0e3a209b0045a56a06987d85981280f523270
Gitweb: https://git.kernel.org/tip/95f0e3a209b0045a56a06987d85981280f523270
Author: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
AuthorDate: Thu, 30 Mar 2023 10:00:14 +08:00
Committer: Josh Poimboeuf <jpoimboe@kernel.org>
CommitterDate: Tue, 16 May 2023 06:06:56 -07:00
x86/unwind/orc: Use swap() instead of open coding it
Swap is a function interface that provides exchange function. To avoid
code duplication, we can use swap function.
./arch/x86/kernel/unwind_orc.c:235:16-17: WARNING opportunity for swap().
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Link: https://bugzilla.openanolis.cn/show_bug.cgi?id=4641
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
Link: https://lore.kernel.org/r/20230330020014.40489-1-jiapeng.chong@linux.alibaba.com
Signed-off-by: Josh Poimboeuf <jpoimboe@kernel.org>
---
arch/x86/kernel/unwind_orc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index 3ac50b7..5fbcb22 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -219,7 +219,6 @@ static struct orc_entry *cur_orc_table = __start_orc_unwind;
static void orc_sort_swap(void *_a, void *_b, int size)
{
struct orc_entry *orc_a, *orc_b;
- struct orc_entry orc_tmp;
int *a = _a, *b = _b, tmp;
int delta = _b - _a;
@@ -231,9 +230,7 @@ static void orc_sort_swap(void *_a, void *_b, int size)
/* Swap the corresponding .orc_unwind entries: */
orc_a = cur_orc_table + (a - cur_orc_ip_table);
orc_b = cur_orc_table + (b - cur_orc_ip_table);
- orc_tmp = *orc_a;
- *orc_a = *orc_b;
- *orc_b = orc_tmp;
+ swap(*orc_a, *orc_b);
}
static int orc_sort_cmp(const void *_a, const void *_b)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] x86/unwind/orc: Use swap() instead of open coding it
@ 2022-08-23 5:51 Jiapeng Chong
0 siblings, 0 replies; 3+ messages in thread
From: Jiapeng Chong @ 2022-08-23 5:51 UTC (permalink / raw)
To: jpoimboe
Cc: peterz, tglx, mingo, dave.hansen, x86, hpa, linux-kernel,
Jiapeng Chong, Abaci Robot
./arch/x86/kernel/unwind_orc.c:217:16-17: WARNING opportunity for swap().
https://bugzilla.openanolis.cn/show_bug.cgi?id=1943
Reported-by: Abaci Robot <abaci@linux.alibaba.com>
Signed-off-by: Jiapeng Chong <jiapeng.chong@linux.alibaba.com>
---
arch/x86/kernel/unwind_orc.c | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/arch/x86/kernel/unwind_orc.c b/arch/x86/kernel/unwind_orc.c
index 0ea57da92940..4569959581b1 100644
--- a/arch/x86/kernel/unwind_orc.c
+++ b/arch/x86/kernel/unwind_orc.c
@@ -201,7 +201,6 @@ static struct orc_entry *cur_orc_table = __start_orc_unwind;
static void orc_sort_swap(void *_a, void *_b, int size)
{
struct orc_entry *orc_a, *orc_b;
- struct orc_entry orc_tmp;
int *a = _a, *b = _b, tmp;
int delta = _b - _a;
@@ -213,9 +212,7 @@ static void orc_sort_swap(void *_a, void *_b, int size)
/* Swap the corresponding .orc_unwind entries: */
orc_a = cur_orc_table + (a - cur_orc_ip_table);
orc_b = cur_orc_table + (b - cur_orc_ip_table);
- orc_tmp = *orc_a;
- *orc_a = *orc_b;
- *orc_b = orc_tmp;
+ swap(*orc_a, *orc_b);
}
static int orc_sort_cmp(const void *_a, const void *_b)
--
2.20.1.7.g153144c
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-05-18 11:09 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-30 2:00 [PATCH] x86/unwind/orc: Use swap() instead of open coding it Jiapeng Chong
2023-05-18 11:08 ` [tip: objtool/core] " tip-bot2 for Jiapeng Chong
-- strict thread matches above, loose matches on Subject: below --
2022-08-23 5:51 [PATCH] " Jiapeng Chong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®