ia64: module: use swap() to make code cleaner
PATCH 1/1 ia64: module: use swap() to make code cleaner
From: Yao Jing <[email protected]>
Use the macro 'swap()' defined in 'include/linux/minmax.h' to avoid opencoding it.
Reported-by Zeal Robot <[email protected]>
Signed-off-by Yao Jing <[email protected]>
--- arch/ia64/kernel/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
arch/ia64/kernel/module.c +2 -4
@@ -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); } } }
Signature · 1 line
2.25.1
Hi!
Quoted 25 lines · On 11/18/21 07:20, [email protected] wrote:
From: Yao Jing <[email protected]>
Use the macro '
swap()' defined in 'include/linux/minmax.h' to avoid opencoding it.Reported-by Zeal Robot <[email protected]>Signed-off-by Yao Jing <[email protected]>--- arch/ia64/kernel/module.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)arch/ia64/kernel/module.c +1
-1@@ -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. */
arch/ia64/kernel/module.c register_unwind_table (struct module *mod) · line 871
Quoted 10 lines
arch/ia64/kernel/module.c +1
-3@@ -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); } } }
I will test this patch later this week.
Adrian
Signature · 4 lines
.''`. John Paul Adrian Glaubitz : :' : Debian Developer - [email protected] `. `' Freie Universitaet Berlin - [email protected] `- GPG: 62FF 8A75 84E0 2956 9546 0006 7426 3B37 F5B5 F913