public inbox for linux-riscv@lists.infradead.org
 help / color / mirror / Atom feed
From: Charlie Jenkins <charlie@rivosinc.com>
To: Jinjie Ruan <ruanjinjie@huawei.com>
Cc: paul.walmsley@sifive.com, palmer@dabbelt.com,
	aou@eecs.berkeley.edu, mcgrof@kernel.org,
	dan.carpenter@linaro.org, rppt@kernel.org,
	alexghiti@rivosinc.com, kernel@esmil.dk,
	linux-riscv@lists.infradead.org
Subject: Re: [PATCH -next] riscv: Use LIST_HEAD() to simplify code
Date: Wed, 4 Sep 2024 11:40:05 -0700	[thread overview]
Message-ID: <ZtiphR6dUIDf/EFp@ghost> (raw)
In-Reply-To: <20240904013344.2026738-1-ruanjinjie@huawei.com>

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@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@rivosinc.com>
Reviewed-by: Charlie Jenkins <charlie@rivosinc.com>


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

  reply	other threads:[~2024-09-04 18:40 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-04  1:33 [PATCH -next] riscv: Use LIST_HEAD() to simplify code Jinjie Ruan
2024-09-04 18:40 ` Charlie Jenkins [this message]
2024-09-17 16:30 ` patchwork-bot+linux-riscv

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZtiphR6dUIDf/EFp@ghost \
    --to=charlie@rivosinc.com \
    --cc=alexghiti@rivosinc.com \
    --cc=aou@eecs.berkeley.edu \
    --cc=dan.carpenter@linaro.org \
    --cc=kernel@esmil.dk \
    --cc=linux-riscv@lists.infradead.org \
    --cc=mcgrof@kernel.org \
    --cc=palmer@dabbelt.com \
    --cc=paul.walmsley@sifive.com \
    --cc=rppt@kernel.org \
    --cc=ruanjinjie@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox