* [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree()
@ 2026-04-18 14:04 Sang-Heon Jeon
2026-04-21 19:34 ` Rob Herring (Arm)
0 siblings, 1 reply; 3+ messages in thread
From: Sang-Heon Jeon @ 2026-04-18 14:04 UTC (permalink / raw)
To: robh, saravanak; +Cc: devicetree, Sang-Heon Jeon
All dt_alloc callbacks passed to __unflatten_device_tree() already
return zero-initialized memory.
- kernel_tree_alloc uses kzalloc()
- early_init_dt_alloc_memory_arch() and dt_alloc_memory() both use
memblock_alloc()
So remove redundant memset after the allocation. No funtional change.
Signed-off-by: Sang-Heon Jeon <ekffu200098@gmail.com>
---
dt-test result
[ 0.529540] ### dt-test ### start of unittest - you will see error messages
[ 0.532758] ### dt-test ### EXPECT \ : Duplicate name in testcase-data, renamed to "duplicate-name#1"
[ 0.537608] ### dt-test ### EXPECT / : Duplicate name in testcase-data, renamed to "duplicate-name#1"
...
[ 0.781700] ### dt-test ### EXPECT / : OF: resolver: overlay phandle fixup failed: -22
[ 0.781718] ### dt-test ### EXPECT / : OF: resolver: node label 'this_label_does_not_exist' not found in live devicetree symbols table
[ 0.781945] ### dt-test ### end of unittest - 423 passed, 0 failed
---
Hello,
While looking into boot information, I found a minor enhancement point.
If I misunderstood anything, please feel free to let me know.
Thank you for taking valuable time to review this work.
Best Regards,
Sang-Heon Jeon
---
drivers/of/fdt.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index becc855ff8b5..647bff2c4521 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -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);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree()
2026-04-18 14:04 [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree() Sang-Heon Jeon
@ 2026-04-21 19:34 ` Rob Herring (Arm)
2026-04-21 22:40 ` Sang-Heon Jeon
0 siblings, 1 reply; 3+ messages in thread
From: Rob Herring (Arm) @ 2026-04-21 19:34 UTC (permalink / raw)
To: Sang-Heon Jeon; +Cc: devicetree, saravanak
On Sat, 18 Apr 2026 23:04:20 +0900, Sang-Heon Jeon wrote:
> All dt_alloc callbacks passed to __unflatten_device_tree() already
> return zero-initialized memory.
>
> - kernel_tree_alloc uses kzalloc()
> - early_init_dt_alloc_memory_arch() and dt_alloc_memory() both use
> memblock_alloc()
>
> So remove redundant memset after the allocation. No funtional change.
That is true now, but it wasn't the case before memblock became used on
all arches.
I've updated the commit message with this info and applied.
Rob
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree()
2026-04-21 19:34 ` Rob Herring (Arm)
@ 2026-04-21 22:40 ` Sang-Heon Jeon
0 siblings, 0 replies; 3+ messages in thread
From: Sang-Heon Jeon @ 2026-04-21 22:40 UTC (permalink / raw)
To: Rob Herring (Arm); +Cc: devicetree, saravanak
Hi,
On Wed, Apr 22, 2026 at 4:34 AM Rob Herring (Arm) <robh@kernel.org> wrote:
>
>
> On Sat, 18 Apr 2026 23:04:20 +0900, Sang-Heon Jeon wrote:
> > All dt_alloc callbacks passed to __unflatten_device_tree() already
> > return zero-initialized memory.
> >
> > - kernel_tree_alloc uses kzalloc()
> > - early_init_dt_alloc_memory_arch() and dt_alloc_memory() both use
> > memblock_alloc()
> >
> > So remove redundant memset after the allocation. No funtional change.
>
> That is true now, but it wasn't the case before memblock became used on
> all arches.
>
> I've updated the commit message with this info and applied.
Thanks for spotting that and for your review :)
> Rob
Best Regards,
Sang-Heon Jeon
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-21 22:40 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-18 14:04 [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree() Sang-Heon Jeon
2026-04-21 19:34 ` Rob Herring (Arm)
2026-04-21 22:40 ` Sang-Heon Jeon
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox