[PATCH] kexec: ppc: Use die() instead of fatal()

Zhang Yanfei zhangyanfei.yes at gmail.com
Wed Mar 27 10:09:16 EDT 2013


From: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>

fatal() nearly does the same thing as die() does, so this is kind of
duplicate. Remove fatal() and use die() instead.

Signed-off-by: Zhang Yanfei <zhangyanfei at cn.fujitsu.com>
---
 kexec/arch/ppc/fixup_dtb.c      |    8 ++++----
 kexec/arch/ppc/libfdt-wrapper.c |    8 ++++----
 kexec/arch/ppc/ops.h            |    2 --
 3 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/kexec/arch/ppc/fixup_dtb.c b/kexec/arch/ppc/fixup_dtb.c
index f832026..2c9e250 100644
--- a/kexec/arch/ppc/fixup_dtb.c
+++ b/kexec/arch/ppc/fixup_dtb.c
@@ -54,7 +54,7 @@ static void fixup_nodes(char *nodes[])
 
 		len = asprintf(&fname, "%s%s", proc_dts, nodes[index]);
 		if (len < 0)
-			fatal("asprintf() failed\n");
+			die("asprintf() failed\n");
 
 		content = slurp_file(fname, &content_size);
 		if (!content) {
@@ -78,7 +78,7 @@ static void fixup_nodes(char *nodes[])
 
 		ret = setprop(node, prop_name, content, content_size);
 		if (ret < 0)
-			fatal("setprop of %s/%s size: %ld failed: %s\n",
+			die("setprop of %s/%s size: %ld failed: %s\n",
 					node_name, prop_name, content_size,
 					fdt_strerror(ret));
 
@@ -125,10 +125,10 @@ static char *expand_buf(int minexpand, char *blob_buf, off_t *blob_size)
 	size = _ALIGN(size + minexpand, EXPAND_GRANULARITY);
 	blob_buf = realloc(blob_buf, size);
 	if (!blob_buf)
-		fatal("Couldn't find %d bytes to expand device tree\n\r", size);
+		die("Couldn't find %d bytes to expand device tree\n\r", size);
 	rc = fdt_open_into(blob_buf, blob_buf, size);
 	if (rc != 0)
-		fatal("Couldn't expand fdt into new buffer: %s\n\r",
+		die("Couldn't expand fdt into new buffer: %s\n\r",
 			fdt_strerror(rc));
 
 	*blob_size = fdt_totalsize(blob_buf);
diff --git a/kexec/arch/ppc/libfdt-wrapper.c b/kexec/arch/ppc/libfdt-wrapper.c
index 5fbd3a8..ef355d0 100644
--- a/kexec/arch/ppc/libfdt-wrapper.c
+++ b/kexec/arch/ppc/libfdt-wrapper.c
@@ -66,10 +66,10 @@ static void expand_buf(int minexpand)
 	size = _ALIGN(size + minexpand, EXPAND_GRANULARITY);
 	buf = realloc(buf, size);
 	if (!buf)
-		fatal("Couldn't find %d bytes to expand device tree\n\r", size);
+		die("Couldn't find %d bytes to expand device tree\n\r", size);
 	rc = fdt_open_into(fdt, buf, size);
 	if (rc != 0)
-		fatal("Couldn't expand fdt into new buffer: %s\n\r",
+		die("Couldn't expand fdt into new buffer: %s\n\r",
 		      fdt_strerror(rc));
 
 	fdt = buf;
@@ -159,7 +159,7 @@ static unsigned long fdt_wrapper_finalize(void)
 
 	rc = fdt_pack(fdt);
 	if (rc != 0)
-		fatal("Couldn't pack flat tree: %s\n\r",
+		die("Couldn't pack flat tree: %s\n\r",
 		      fdt_strerror(rc));
 	return (unsigned long)fdt;
 }
@@ -185,5 +185,5 @@ void fdt_init(void *blob)
 
 	err = fdt_open_into(fdt, fdt, bufsize);
 	if (err != 0)
-		fatal("fdt_init(): %s\n\r", fdt_strerror(err));
+		die("fdt_init(): %s\n\r", fdt_strerror(err));
 }
diff --git a/kexec/arch/ppc/ops.h b/kexec/arch/ppc/ops.h
index a2eb140..7334a05 100644
--- a/kexec/arch/ppc/ops.h
+++ b/kexec/arch/ppc/ops.h
@@ -145,6 +145,4 @@ static inline char *get_path(const void *phandle, char *buf, int len)
 	return NULL;
 }
 
-#define fatal(args...) { printf(args); exit(1); }
-
 #endif /* _PPC_BOOT_OPS_H_ */
-- 
1.7.1



More information about the kexec mailing list