Skip to content

Commit 3cc754c

Browse files
ruanjinjie-engpalmer-dabbelt
authored andcommitted
riscv: Use LIST_HEAD() to simplify code
list_head can be initialized automatically with LIST_HEAD() instead of calling INIT_LIST_HEAD(). Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com> Tested-by: Charlie Jenkins <charlie@rivosinc.com> Reviewed-by: Charlie Jenkins <charlie@rivosinc.com> Link: https://lore.kernel.org/r/20240904013344.2026738-1-ruanjinjie@huawei.com Signed-off-by: Palmer Dabbelt <palmer@rivosinc.com>
1 parent e36ddf3 commit 3cc754c

1 file changed

Lines changed: 1 addition & 3 deletions

File tree

arch/riscv/kernel/module.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -787,17 +787,15 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
787787
int res;
788788
unsigned int num_relocations = sechdrs[relsec].sh_size / sizeof(*rel);
789789
struct hlist_head *relocation_hashtable;
790-
struct list_head used_buckets_list;
791790
unsigned int hashtable_bits;
791+
LIST_HEAD(used_buckets_list);
792792

793793
hashtable_bits = initialize_relocation_hashtable(num_relocations,
794794
&relocation_hashtable);
795795

796796
if (!relocation_hashtable)
797797
return -ENOMEM;
798798

799-
INIT_LIST_HEAD(&used_buckets_list);
800-
801799
pr_debug("Applying relocate section %u to %u\n", relsec,
802800
sechdrs[relsec].sh_info);
803801

0 commit comments

Comments
 (0)