Skip to contentSkip to conversation

fdt_support.c: Correct linux, initrd-start/end setting

PATCH New Tom Rini 2 participants 2 messages Jan 20, 2014 – Jan 21, 2014

lore
Share & tools
lore

Tom Rini

author
#0 lore raw

PATCH 1/1 fdt_support.c: Correct linux, initrd-start/end setting

The change to add 64bit initrd support broke 32bit initrd support as it always set 64bits worth of data into the properties, even on 32bit systems. The fix is to use addr_cell_len (which already says how much data is in 'tmp') to set the property, rather than always setting 8. Thanks to Stephen Warren for pointing out the fix here.

---
 common/fdt_support.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/fdt_support.c +2 -2
index b9dce99..f9f358e 100644
@@ -204,7 +204,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 	if ((path == NULL) || force) {
 		write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
 		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-start", &tmp, sizeof(tmp));
+			"linux,initrd-start", &tmp, addr_cell_len);
 		if (err < 0) {
 			printf("WARNING: "
 				"could not set linux,initrd-start %s.\n",
@@ -213,7 +213,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		}
 		write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
 		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-end", &tmp, sizeof(tmp));
+			"linux,initrd-end", &tmp, addr_cell_len);
 		if (err < 0) {
 			printf("WARNING: could not set linux,initrd-end %s.\n",
 				fdt_strerror(err));
Signature · 1 line
1.7.9.5
#1 lore raw

PATCH 1/1 fdt_support.c: Correct linux, initrd-start/end setting

Quoted 45 lines

-----Original Messages-----
From: "Tom Rini" <[email protected]>
Sent Time: 2014-01-21 06:47:25 (Tuesday)
To: u-boot at lists.denx.de
Cc:
Subject: [U-Boot] [PATCH] fdt_support.c: Correct linux, initrd-start/end setting

The change to add 64bit initrd support broke 32bit initrd support as it always set 64bits worth of data into the properties, even on 32bit systems. The fix is to use addr_cell_len (which already says how much data is in 'tmp') to set the property, rather than always setting 8. Thanks to Stephen Warren for pointing out the fix here.

---
 common/fdt_support.c |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
common/fdt_support.c +2 -2
index b9dce99..f9f358e 100644
@@ -204,7 +204,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 	if ((path == NULL) || force) {
 		write_cell((u8 *)&tmp, initrd_start, addr_cell_len);
 		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-start", &tmp, sizeof(tmp));
+			"linux,initrd-start", &tmp, addr_cell_len);
 		if (err < 0) {
 			printf("WARNING: "
 				"could not set linux,initrd-start %s.\n",
@@ -213,7 +213,7 @@ int fdt_initrd(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		}
 		write_cell((u8 *)&tmp, initrd_end, addr_cell_len);
 		err = fdt_setprop(fdt, nodeoffset,
-			"linux,initrd-end", &tmp, sizeof(tmp));
+			"linux,initrd-end", &tmp, addr_cell_len);
 		if (err < 0) {
 			printf("WARNING: could not set linux,initrd-end %s.\n",
 				fdt_strerror(err));
Signature · 1 line
1.7.9.5

It should be like this. Acked.