[PATCH] x86/crash: Remove redundant 0 value initialization

Liao Yuanhong posted 1 patch 1 month, 2 weeks ago
arch/x86/kernel/crash.c | 2 --
1 file changed, 2 deletions(-)
[PATCH] x86/crash: Remove redundant 0 value initialization
Posted by Liao Yuanhong 1 month, 2 weeks ago
The crash_mem struct is already zeroed by vzalloc(). It's redundant to
initialize cmem->nr_ranges to 0.

Signed-off-by: Liao Yuanhong <liaoyuanhong@vivo.com>
---
 arch/x86/kernel/crash.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c
index c6b12bed173d..60bb24ddd36f 100644
--- a/arch/x86/kernel/crash.c
+++ b/arch/x86/kernel/crash.c
@@ -172,7 +172,6 @@ static struct crash_mem *fill_up_crash_elf_data(void)
 		return NULL;
 
 	cmem->max_nr_ranges = nr_ranges;
-	cmem->nr_ranges = 0;
 
 	return cmem;
 }
@@ -332,7 +331,6 @@ int crash_setup_memmap_entries(struct kimage *image, struct boot_params *params)
 		return -ENOMEM;
 
 	cmem->max_nr_ranges = nr_ranges;
-	cmem->nr_ranges = 0;
 
 	memset(&cmd, 0, sizeof(struct crash_memmap_data));
 	cmd.params = params;
-- 
2.34.1
Re: [PATCH] x86/crash: Remove redundant 0 value initialization
Posted by Markus Elfring 1 month, 2 weeks ago
> The crash_mem struct is already zeroed by vzalloc(). It's redundant to
> initialize cmem->nr_ranges to 0.

See also:
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Documentation/process/submitting-patches.rst?h=v6.17-rc2#n94

Regards,
Markus