mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH master] of: override existing reg property in of_fixup_reserved_memory
@ 2023-06-08 14:38 Ahmad Fatoum
  2023-06-09  6:19 ` Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Ahmad Fatoum @ 2023-06-08 14:38 UTC (permalink / raw)
  To: barebox; +Cc: Ahmad Fatoum

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




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH master] of: override existing reg property in of_fixup_reserved_memory
  2023-06-08 14:38 [PATCH master] of: override existing reg property in of_fixup_reserved_memory Ahmad Fatoum
@ 2023-06-09  6:19 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2023-06-09  6:19 UTC (permalink / raw)
  To: Ahmad Fatoum; +Cc: barebox

On Thu, Jun 08, 2023 at 04:38:18PM +0200, Ahmad Fatoum wrote:
> 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(-)

Applied, thanks

Sascha

> 
> 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
> 
> 
> 

-- 
Pengutronix e.K.                           |                             |
Steuerwalder Str. 21                       | http://www.pengutronix.de/  |
31137 Hildesheim, Germany                  | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |



^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-06-09  6:20 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-08 14:38 [PATCH master] of: override existing reg property in of_fixup_reserved_memory Ahmad Fatoum
2023-06-09  6:19 ` Sascha Hauer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox