mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 1/2] of: fdt: Fix fdt size_dt_struct
@ 2013-11-08 14:23 Sascha Hauer
  2013-11-08 14:23 ` [PATCH 2/2] of: fdt: reorder fdt_header initialization Sascha Hauer
  0 siblings, 1 reply; 2+ messages in thread
From: Sascha Hauer @ 2013-11-08 14:23 UTC (permalink / raw)
  To: barebox

size_dt_struct was calculated too big, we have to substract ofs.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/fdt.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index 5055eee..b136dad 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -409,10 +409,9 @@ void *of_flatten_dtb(struct device_node *node)
 	fdt.dt_nextofs = dt_next_ofs(fdt.dt_nextofs, sizeof(struct fdt_node_header));
 
 	header.size_dt_strings = cpu_to_fdt32(fdt.str_nextofs);
-	header.size_dt_struct = cpu_to_fdt32(fdt.dt_nextofs);
+	header.size_dt_struct = cpu_to_fdt32(fdt.dt_nextofs - ofs);
 
 	header.off_dt_struct = cpu_to_fdt32(ofs);
-
 	header.off_dt_strings = cpu_to_fdt32(fdt.dt_nextofs);
 
 	if (fdt.dt_size - fdt.dt_nextofs < fdt.str_nextofs) {
-- 
1.8.4.rc3


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

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

* [PATCH 2/2] of: fdt: reorder fdt_header initialization
  2013-11-08 14:23 [PATCH 1/2] of: fdt: Fix fdt size_dt_struct Sascha Hauer
@ 2013-11-08 14:23 ` Sascha Hauer
  0 siblings, 0 replies; 2+ messages in thread
From: Sascha Hauer @ 2013-11-08 14:23 UTC (permalink / raw)
  To: barebox

No functional change, just reorder the initialization of
the different offset/size members of fdt_header in increasing
order to make it easier to read.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
---
 drivers/of/fdt.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/fdt.c b/drivers/of/fdt.c
index b136dad..3dc5d47 100644
--- a/drivers/of/fdt.c
+++ b/drivers/of/fdt.c
@@ -408,11 +408,11 @@ void *of_flatten_dtb(struct device_node *node)
 	nh->tag = cpu_to_fdt32(FDT_END);
 	fdt.dt_nextofs = dt_next_ofs(fdt.dt_nextofs, sizeof(struct fdt_node_header));
 
-	header.size_dt_strings = cpu_to_fdt32(fdt.str_nextofs);
+	header.off_dt_struct = cpu_to_fdt32(ofs);
 	header.size_dt_struct = cpu_to_fdt32(fdt.dt_nextofs - ofs);
 
-	header.off_dt_struct = cpu_to_fdt32(ofs);
 	header.off_dt_strings = cpu_to_fdt32(fdt.dt_nextofs);
+	header.size_dt_strings = cpu_to_fdt32(fdt.str_nextofs);
 
 	if (fdt.dt_size - fdt.dt_nextofs < fdt.str_nextofs) {
 		fdt.dt = memalign_realloc(fdt.dt, fdt.dt_size,
-- 
1.8.4.rc3


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

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

end of thread, other threads:[~2013-11-08 14:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-11-08 14:23 [PATCH 1/2] of: fdt: Fix fdt size_dt_struct Sascha Hauer
2013-11-08 14:23 ` [PATCH 2/2] of: fdt: reorder fdt_header initialization Sascha Hauer

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