]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
of/fdt: remove redundant memset in __unflatten_device_tree()
authorSang-Heon Jeon <ekffu200098@gmail.com>
Sat, 18 Apr 2026 14:04:20 +0000 (23:04 +0900)
committerRob Herring (Arm) <robh@kernel.org>
Tue, 5 May 2026 15:31:50 +0000 (10:31 -0500)
Now that memblock and slab allocators are the only allocators and both
return zero-initialized memory, zeroing the memory ourselves is
redundant. The allocators used are:

- kernel_tree_alloc uses kzalloc()
- early_init_dt_alloc_memory_arch() and dt_alloc_memory() both use
  memblock_alloc()

Remove redundant memset after the allocation. No funtional change.

Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
Link: https://patch.msgid.link/20260418140420.2221736-1-ekffu200098@gmail.com
Signed-off-by: Rob Herring (Arm) <robh@kernel.org>
drivers/of/fdt.c

index 82f7327c59ea90e3047d169e10504773741ff62a..ba65e36e183cc032cb12209fc66362e76d350cdf 100644 (file)
@@ -391,8 +391,6 @@ void *__unflatten_device_tree(const void *blob,
        if (!mem)
                return NULL;
 
-       memset(mem, 0, size);
-
        *(__be32 *)(mem + size) = cpu_to_be32(0xdeadbeef);
 
        pr_debug("  unflattening %p...\n", mem);