mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Subject: [PATCH 1/2] of: Return copy of live tree as fixed tree
Date: Mon, 22 Mar 2021 12:24:11 +0100	[thread overview]
Message-ID: <20210322112412.4232-1-s.hauer@pengutronix.de> (raw)

the of fixups modify the the tree passed to them. It is undesired that
these modify the live tree, so when we are requested to return the fixed
live tree then make a copy first.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 common/oftree.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/common/oftree.c b/common/oftree.c
index 075b9d6b8b..4868d8812e 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -325,6 +325,9 @@ struct fdt_header *of_get_fixed_tree(struct device_node *node)
 		node = of_get_root_node();
 		if (!node)
 			return NULL;
+		node = of_copy_node(NULL, node);
+		if (!node)
+			return NULL;
 	}
 
 	ret = of_fix_tree(node);
-- 
2.29.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox


             reply	other threads:[~2021-03-22 11:25 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-22 11:24 Sascha Hauer [this message]
2021-03-22 11:24 ` [PATCH 2/2] reboot-mode: drop now unnecessary check Sascha Hauer
2021-03-22 11:50   ` Ahmad Fatoum
2021-03-22 11:48 ` [PATCH 1/2] of: Return copy of live tree as fixed tree Ahmad Fatoum
2021-03-22 12:31   ` Sascha Hauer

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=20210322112412.4232-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=barebox@lists.infradead.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