Skip to contentSkip to conversation

kexec: Use die() to simplify code

PATCH Applied Zhang Yanfei 2 participants 2 messages Mar 27, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 kexec: Use die() to simplify code

From: Zhang Yanfei <[email protected]>

Use die() to simplify code.

---
 kexec/arch/ppc/fixup_dtb.c        |    4 +---
 kexec/arch/ppc/kexec-elf-ppc.c    |    3 +--
 kexec/arch/ppc/kexec-uImage-ppc.c |    3 +--
 kexec/arch/sh/kexec-sh.c          |    3 +--
 4 files changed, 4 insertions(+), 9 deletions(-)
kexec/arch/ppc/fixup_dtb.c +1 -3
index f832026..b10ac59 100644
@@ -58,9 +58,7 @@ static void fixup_nodes(char *nodes[])
 
 		content = slurp_file(fname, &content_size);
 		if (!content) {
-			fprintf(stderr, "Can't open %s: %s\n",
-					fname, strerror(errno));
-			exit(1);
+			die("Can't open %s: %s\n", fname, strerror(errno));
 		}
 
 		prop_name = fname + len;
kexec/arch/ppc/kexec-elf-ppc.c +1 -2
index 694befb..3daca2d 100644
@@ -227,8 +227,7 @@ int elf_ppc_load(int argc, char **argv,	const char *buf, off_t len,
 
 		case OPT_NODES:
 			if (cur_fixup >= FIXUP_ENTRYS) {
-				fprintf(stderr, "The number of entries for the fixup is too large\n");
-				exit(1);
+				die("The number of entries for the fixup is too large\n");
 			}
 			fixup_nodes[cur_fixup] = optarg;
 			cur_fixup++;
kexec/arch/ppc/kexec-uImage-ppc.c +1 -2
index c4d39f2..9113fbe 100644
@@ -130,8 +130,7 @@ static int ppc_load_bare_bits(int argc, char **argv, const char *buf,
 
 		case OPT_NODES:
 			if (cur_fixup >= FIXUP_ENTRYS) {
-				fprintf(stderr, "The number of entries for the fixup is too large\n");
-				exit(1);
+				die("The number of entries for the fixup is too large\n");
 			}
 			fixup_nodes[cur_fixup] = optarg;
 			cur_fixup++;
kexec/arch/sh/kexec-sh.c +1 -2
index 7710fdf..ea56041 100644
@@ -159,8 +159,7 @@ char *get_append(void)
         FILE *fp;
         int len;
         if((fp = fopen("/proc/cmdline", "r")) == NULL){
-              printf("/proc/cmdline file open error !!\n");
-              exit(1);
+              die("/proc/cmdline file open error !!\n");
         }
         fgets(append_buf, 256, fp);
         len = strlen(append_buf);
Signature · 6 lines
1.7.1

_______________________________________________
kexec mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/kexec