From: Sang-Heon Jeon <ekffu200098@gmail.com>
To: robh@kernel.org, saravanak@kernel.org
Cc: devicetree@vger.kernel.org, Sang-Heon Jeon <ekffu200098@gmail.com>
Subject: [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree()
Date: Sat, 18 Apr 2026 23:04:20 +0900 [thread overview]
Message-ID: <20260418140420.2221736-1-ekffu200098@gmail.com> (raw)
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
next reply other threads:[~2026-04-18 14:04 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-18 14:04 Sang-Heon Jeon [this message]
2026-04-21 19:34 ` [PATCH] of/fdt: remove redundant memset in __unflatten_device_tree() Rob Herring (Arm)
2026-04-21 22:40 ` Sang-Heon Jeon
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=20260418140420.2221736-1-ekffu200098@gmail.com \
--to=ekffu200098@gmail.com \
--cc=devicetree@vger.kernel.org \
--cc=robh@kernel.org \
--cc=saravanak@kernel.org \
/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