Thread (1 message) 1 message, 1 author, 2010-08-19

[PATCH v2 3/3] Prevent initrd-start and initrd-end from appearing multiple times

flat view
DORMANTno replies

From: Matthew McClintock <hidden>
Date: 2010-08-19 05:12:20
Also in: kexec
Subsystem: the rest · Maintainer: Linus Torvalds

We always remove the old entry, and add it back if it is needed
on for the kexec'ed kernel

Signed-off-by: Matthew McClintock <redacted>
---
 kexec/arch/ppc/fixup_dtb.c |   20 ++++++++++----------
 1 files changed, 10 insertions(+), 10 deletions(-)
diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index 910a3f0..205fd77 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -160,7 +160,7 @@ static void fixup_reserve_regions(struct kexec_info *info, char *blob_buf, off_t
 				goto out;
 			}
 		}
-	} else {
+	} else if (ramdisk || reuse_initrd) {
 		/* Otherwise we just add back the ramdisk and the device tree
 		 * is already in the list */
 		ret = fdt_add_mem_rsv(blob_buf, ramdisk_base, ramdisk_size);
@@ -300,13 +300,16 @@ static void fixup_initrd(char *blob_buf)
 
 	nodeoffset = fdt_path_offset(blob_buf, "/chosen");
 
-	if ((reuse_initrd || ramdisk) &&
-		((ramdisk_base != 0) && (ramdisk_size != 0))) {
-		if (nodeoffset < 0) {
-			printf("fdt_initrd: %s\n", fdt_strerror(nodeoffset));
-			return;
-		}
+	if (nodeoffset < 0) {
+		printf("fdt_initrd: %s\n", fdt_strerror(nodeoffset));
+		return;
+	}
+
+	fdt_delprop(blob_buf, nodeoffset, "linux,initrd-start");
+	fdt_delprop(blob_buf, nodeoffset, "linux,initrd-end");
 
+	if ((reuse_initrd || ramdisk) &&
+	   ((ramdisk_base != 0) && (ramdisk_size != 0))) {
 		tmp = ramdisk_base;
 		err = fdt_setprop(blob_buf, nodeoffset,
 			"linux,initrd-start", &tmp, sizeof(tmp));
@@ -325,9 +328,6 @@ static void fixup_initrd(char *blob_buf)
 				fdt_strerror(err));
 				return;
 		}
-	} else {
-		fdt_delprop(blob_buf, nodeoffset, "linux,initrd-start");
-		fdt_delprop(blob_buf, nodeoffset, "linux,initrd-end");
 	}
 }
 
-- 
1.6.0.6
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help