summaryrefslogtreecommitdiffstats
path: root/commands
diff options
context:
space:
mode:
authorAhmad Fatoum <a.fatoum@pengutronix.de>2023-05-19 12:01:19 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2023-05-25 09:36:01 +0200
commit1d4e0a09991c7d8dbe7aad2b299c999f416b6377 (patch)
treecf0f3eeb6185f02e743ac29ccef3d4bd1b86318f /commands
parent4c7f352e80e7bf66014a7c81b3cc20c3d182afd5 (diff)
downloadbarebox-1d4e0a09991c7d8dbe7aad2b299c999f416b6377.tar.gz
barebox-1d4e0a09991c7d8dbe7aad2b299c999f416b6377.tar.xz
commands: of_dump: use of_dup instead of flattening/unflattening
Flattening and unflattening is needlessly laborious. We have of_dup for that, so let's make use of it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Link: https://lore.barebox.org/20230519100120.2365970-6-a.fatoum@pengutronix.de Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'commands')
-rw-r--r--commands/of_dump.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/commands/of_dump.c b/commands/of_dump.c
index f8e7280fd9..1d6c019bf0 100644
--- a/commands/of_dump.c
+++ b/commands/of_dump.c
@@ -79,21 +79,9 @@ static int do_of_dump(int argc, char *argv[])
} else {
root = of_get_root_node();
- if (fix) {
- /* create a copy of internal devicetree */
- void *fdt;
- fdt = of_flatten_dtb(root);
- root = of_unflatten_dtb(fdt, fdt_totalsize(fdt));
-
- free(fdt);
-
- if (IS_ERR(root)) {
- ret = PTR_ERR(root);
- goto out;
- }
-
- of_free = root;
- }
+ /* copy internal device tree to apply fixups onto it */
+ if (fix)
+ root = of_free = of_dup(root);
}
if (fix) {