1

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>
This commit is contained in:
Jinjie Ruan 2024-09-04 09:33:44 +08:00 committed by Palmer Dabbelt
parent e36ddf3226
commit 3cc754c237
No known key found for this signature in database
GPG Key ID: 2E1319F35FBB1889

View File

@ -787,8 +787,8 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
int res; int res;
unsigned int num_relocations = sechdrs[relsec].sh_size / sizeof(*rel); unsigned int num_relocations = sechdrs[relsec].sh_size / sizeof(*rel);
struct hlist_head *relocation_hashtable; struct hlist_head *relocation_hashtable;
struct list_head used_buckets_list;
unsigned int hashtable_bits; unsigned int hashtable_bits;
LIST_HEAD(used_buckets_list);
hashtable_bits = initialize_relocation_hashtable(num_relocations, hashtable_bits = initialize_relocation_hashtable(num_relocations,
&relocation_hashtable); &relocation_hashtable);
@ -796,8 +796,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
if (!relocation_hashtable) if (!relocation_hashtable)
return -ENOMEM; return -ENOMEM;
INIT_LIST_HEAD(&used_buckets_list);
pr_debug("Applying relocate section %u to %u\n", relsec, pr_debug("Applying relocate section %u to %u\n", relsec,
sechdrs[relsec].sh_info); sechdrs[relsec].sh_info);