mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH master] of: override existing reg property in of_fixup_reserved_memory
Date: Thu,  8 Jun 2023 16:38:18 +0200	[thread overview]
Message-ID: <20230608143818.3147443-1-a.fatoum@pengutronix.de> (raw)

of_new_property doesn't care for existing properties and would happily
add a property that already exists leading Linux to trip over it when
creating the VFS view into the device tree.

Fix this by using of_set_property, which would delete an existing
reg property first, before adding it anew.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 common/oftree.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/common/oftree.c b/common/oftree.c
index 620de6ed5649..3e85070d113c 100644
--- a/common/oftree.c
+++ b/common/oftree.c
@@ -308,8 +308,8 @@ int of_fixup_reserved_memory(struct device_node *root, void *_res)
 	of_write_number(reg, res->start, addr_n_cells);
 	of_write_number(reg + addr_n_cells, resource_size(res), size_n_cells);
 
-	of_new_property(child, "reg", reg,
-			(addr_n_cells + size_n_cells) * sizeof(*reg));
+	of_set_property(child, "reg", reg,
+			(addr_n_cells + size_n_cells) * sizeof(*reg), true);
 
 	return 0;
 }
-- 
2.39.2




             reply	other threads:[~2023-06-08 14:39 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-06-08 14:38 Ahmad Fatoum [this message]
2023-06-09  6:19 ` 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=20230608143818.3147443-1-a.fatoum@pengutronix.de \
    --to=a.fatoum@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