]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ia64: module: use swap() to make code cleaner
authorYang Guang <yang.guang5@zte.com.cn>
Fri, 14 Jan 2022 22:03:13 +0000 (14:03 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Sat, 15 Jan 2022 14:30:24 +0000 (16:30 +0200)
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid
opencoding it.

Link: https://lkml.kernel.org/r/20211104062642.1506539-1-yang.guang5@zte.com.cn
Signed-off-by: Yang Guang <yang.guang5@zte.com.cn>
Reported-by: Zeal Robot <zealci@zte.com.cn>
Cc: David Yang <davidcomponentone@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
arch/ia64/kernel/module.c

index 2cba53c1da82e934109e63248247ddcdc1fb89af..360f36b0eb3ff59e5be17f44d86fca1eb0f98ba1 100644 (file)
@@ -848,7 +848,7 @@ register_unwind_table (struct module *mod)
 {
        struct unw_table_entry *start = (void *) mod->arch.unwind->sh_addr;
        struct unw_table_entry *end = start + mod->arch.unwind->sh_size / sizeof (*start);
-       struct unw_table_entry tmp, *e1, *e2, *core, *init;
+       struct unw_table_entry *e1, *e2, *core, *init;
        unsigned long num_init = 0, num_core = 0;
 
        /* First, count how many init and core unwind-table entries there are.  */
@@ -865,9 +865,7 @@ register_unwind_table (struct module *mod)
        for (e1 = start; e1 < end; ++e1) {
                for (e2 = e1 + 1; e2 < end; ++e2) {
                        if (e2->start_offset < e1->start_offset) {
-                               tmp = *e1;
-                               *e1 = *e2;
-                               *e2 = tmp;
+                               swap(*e1, *e2);
                        }
                }
        }