* [PATCH] ARC: dw2 unwind: use swap() to make code cleaner
@ 2021-11-10 5:56 cgel.zte
2021-12-29 3:52 ` Vineet Gupta
0 siblings, 1 reply; 2+ messages in thread
From: cgel.zte @ 2021-11-10 5:56 UTC (permalink / raw)
To: vgupta
Cc: ye.guojin, yangdianqing, wjc, linux-snps-arc, linux-kernel, Zeal Robot
From: Ye Guojin <ye.guojin@zte.com.cn>
This was found by coccicheck:
./arch/arc/kernel/unwind.c, 251, 22-23, WARNING opportunity for swap()
./arch/arc/kernel/unwind.c, 254, 18-19, WARNING opportunity for swap()
Addtionally, adjust the sequence of header files to be arranged in
alphabetical order.
Reported-by: Zeal Robot <zealci@zte.com.cn>
Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
---
arch/arc/kernel/unwind.c | 26 +++++++++++---------------
1 file changed, 11 insertions(+), 15 deletions(-)
diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
index 9e28058cdba8..ea795304982a 100644
--- a/arch/arc/kernel/unwind.c
+++ b/arch/arc/kernel/unwind.c
@@ -10,17 +10,18 @@
* is not much point in implementing the full Dwarf2 unwind API.
*/
-#include <linux/sched.h>
-#include <linux/module.h>
+#include <asm/sections.h>
+#include <asm/unaligned.h>
+#include <asm/unwind.h>
#include <linux/memblock.h>
-#include <linux/sort.h>
+#include <linux/minmax.h>
+#include <linux/module.h>
+#include <linux/ptrace.h>
+#include <linux/sched.h>
#include <linux/slab.h>
+#include <linux/sort.h>
#include <linux/stop_machine.h>
#include <linux/uaccess.h>
-#include <linux/ptrace.h>
-#include <asm/sections.h>
-#include <asm/unaligned.h>
-#include <asm/unwind.h>
extern char __start_unwind[], __end_unwind[];
/* extern const u8 __start_unwind_hdr[], __end_unwind_hdr[];*/
@@ -245,14 +246,9 @@ static void swap_eh_frame_hdr_table_entries(void *p1, void *p2, int size)
{
struct eh_frame_hdr_table_entry *e1 = p1;
struct eh_frame_hdr_table_entry *e2 = p2;
- unsigned long v;
-
- v = e1->start;
- e1->start = e2->start;
- e2->start = v;
- v = e1->fde;
- e1->fde = e2->fde;
- e2->fde = v;
+
+ swap(e1->start, e2->start);
+ swap(e1->fde, e2->fde);
}
static void init_unwind_hdr(struct unwind_table *table,
--
2.25.1
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] ARC: dw2 unwind: use swap() to make code cleaner
2021-11-10 5:56 [PATCH] ARC: dw2 unwind: use swap() to make code cleaner cgel.zte
@ 2021-12-29 3:52 ` Vineet Gupta
0 siblings, 0 replies; 2+ messages in thread
From: Vineet Gupta @ 2021-12-29 3:52 UTC (permalink / raw)
To: cgel.zte, vgupta
Cc: ye.guojin, yangdianqing, wjc, linux-snps-arc, linux-kernel, Zeal Robot
On 11/9/21 9:56 PM, cgel.zte@gmail.com wrote:
> From: Ye Guojin <ye.guojin@zte.com.cn>
>
> This was found by coccicheck:
> ./arch/arc/kernel/unwind.c, 251, 22-23, WARNING opportunity for swap()
> ./arch/arc/kernel/unwind.c, 254, 18-19, WARNING opportunity for swap()
>
> Addtionally, adjust the sequence of header files to be arranged in
> alphabetical order.
>
> Reported-by: Zeal Robot <zealci@zte.com.cn>
> Signed-off-by: Ye Guojin <ye.guojin@zte.com.cn>
> ---
> arch/arc/kernel/unwind.c | 26 +++++++++++---------------
> 1 file changed, 11 insertions(+), 15 deletions(-)
>
> diff --git a/arch/arc/kernel/unwind.c b/arch/arc/kernel/unwind.c
> index 9e28058cdba8..ea795304982a 100644
> --- a/arch/arc/kernel/unwind.c
> +++ b/arch/arc/kernel/unwind.c
> @@ -10,17 +10,18 @@
> * is not much point in implementing the full Dwarf2 unwind API.
> */
>
> -#include <linux/sched.h>
> -#include <linux/module.h>
> +#include <asm/sections.h>
> +#include <asm/unaligned.h>
> +#include <asm/unwind.h>
No this is not correct. We always include linux/* first followed by any
specific arch asm/* includes.
> #include <linux/memblock.h>
> -#include <linux/sort.h>
> +#include <linux/minmax.h>
> +#include <linux/module.h>
> +#include <linux/ptrace.h>
> +#include <linux/sched.h>
> #include <linux/slab.h>
> +#include <linux/sort.h>
> #include <linux/stop_machine.h>
> #include <linux/uaccess.h>
> -#include <linux/ptrace.h>
> -#include <asm/sections.h>
> -#include <asm/unaligned.h>
> -#include <asm/unwind.h>
_______________________________________________
linux-snps-arc mailing list
linux-snps-arc@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-snps-arc
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2021-12-29 3:52 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-11-10 5:56 [PATCH] ARC: dw2 unwind: use swap() to make code cleaner cgel.zte
2021-12-29 3:52 ` Vineet Gupta
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).