From mboxrd@z Thu Jan 1 00:00:00 1970 Content-Type: multipart/mixed; boundary="===============3635873396846554758==" MIME-Version: 1.0 From: kernel test robot Subject: [PATCH] coccinelle: misc: fix swap.cocci warnings Date: Sun, 28 Nov 2021 02:42:56 +0800 Message-ID: <20211127184256.GA3051@3e28b18dce75> List-Id: To: kbuild@lists.01.org --===============3635873396846554758== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CC: kbuild-all(a)lists.01.org CC: linux-kernel(a)vger.kernel.org TO: Denis Efremov CC: Julia Lawall CC: Thomas Gleixner CC: Ingo Molnar CC: Borislav Petkov CC: x86(a)kernel.org CC: "H. Peter Anvin" CC: Josh Poimboeuf CC: Peter Zijlstra CC: Miroslav Benes From: kernel test robot arch/x86/kernel/unwind_orc.c:212:16-17: WARNING opportunity for swap() Check for opencoded swap() implementation. Generated by: scripts/coccinelle/misc/swap.cocci CC: Denis Efremov Reported-by: kernel test robot Signed-off-by: kernel test robot --- tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git = master head: c5c17547b778975b3d83a73c8d84e8fb5ecf3ba5 commit: 7845daa8bd72efa8bbc1de122edfce6e058bbe41 coccinelle: misc: add swap= script :::::: branch date: 22 hours ago :::::: commit date: 7 months ago Please take the patch only if it's a positive warning. Thanks! unwind_orc.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) --- a/arch/x86/kernel/unwind_orc.c +++ b/arch/x86/kernel/unwind_orc.c @@ -196,7 +196,6 @@ static struct orc_entry *cur_orc_table =3D 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 =3D _a, *b =3D _b, tmp; int delta =3D _b - _a; = @@ -208,9 +207,7 @@ static void orc_sort_swap(void *_a, void /* Swap the corresponding .orc_unwind entries: */ orc_a =3D cur_orc_table + (a - cur_orc_ip_table); orc_b =3D cur_orc_table + (b - cur_orc_ip_table); - orc_tmp =3D *orc_a; - *orc_a =3D *orc_b; - *orc_b =3D orc_tmp; + swap(*orc_a, *orc_b); } = static int orc_sort_cmp(const void *_a, const void *_b) --===============3635873396846554758==--