[PATCH -next] riscv: Use LIST_HEAD() to simplify code
Charlie Jenkins
charlie at rivosinc.com
Wed Sep 4 11:40:05 PDT 2024
On Wed, Sep 04, 2024 at 09:33:44AM +0800, Jinjie Ruan wrote:
> list_head can be initialized automatically with LIST_HEAD()
> instead of calling INIT_LIST_HEAD().
>
> Signed-off-by: Jinjie Ruan <ruanjinjie at huawei.com>
> ---
> arch/riscv/kernel/module.c | 4 +---
> 1 file changed, 1 insertion(+), 3 deletions(-)
>
> diff --git a/arch/riscv/kernel/module.c b/arch/riscv/kernel/module.c
> index 906f9a3a5d65..1cd461f3d872 100644
> --- a/arch/riscv/kernel/module.c
> +++ b/arch/riscv/kernel/module.c
> @@ -787,8 +787,8 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
> int res;
> unsigned int num_relocations = sechdrs[relsec].sh_size / sizeof(*rel);
> struct hlist_head *relocation_hashtable;
> - struct list_head used_buckets_list;
> unsigned int hashtable_bits;
> + LIST_HEAD(used_buckets_list);
>
> hashtable_bits = initialize_relocation_hashtable(num_relocations,
> &relocation_hashtable);
> @@ -796,8 +796,6 @@ int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
> if (!relocation_hashtable)
> return -ENOMEM;
>
> - INIT_LIST_HEAD(&used_buckets_list);
> -
> pr_debug("Applying relocate section %u to %u\n", relsec,
> sechdrs[relsec].sh_info);
>
> --
> 2.34.1
>
Looks great!
Tested-by: Charlie Jenkins <charlie at rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie at rivosinc.com>
More information about the linux-riscv
mailing list