public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot-Users] [PATCH: u-boot-fdt] Improve error print messages.
@ 2007-08-08  1:26 Jerry Van Baren
  0 siblings, 0 replies; 7+ messages in thread
From: Jerry Van Baren @ 2007-08-08  1:26 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
---

Take 2, tightening up the prints some more, combine the multi-line
strings onto one line where possible.  Pretty soon we will have the
error message of ed <http://snap.nlc.dcccd.edu/learn/nlc/ed.html>.  ;-)

 common/fdt_support.c |   52 ++++++++++++++++++++-----------------------------
 1 files changed, 21 insertions(+), 31 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 259bd42..caaa682 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -54,7 +54,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 
 	err = fdt_check_header(fdt);
 	if (err < 0) {
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("fdt_chosen: %s\n", fdt_strerror(err));
 		return err;
 	}
 
@@ -66,11 +66,11 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 
 		err = fdt_num_reservemap(fdt, &used, &total);
 		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_chosen: %s\n", fdt_strerror(err));
 			return err;
 		}
 		if (used >= total) {
-			printf("WARNING fdt_chosen: "
+			printf("WARNING: "
 				"no room in the reserved map (%d of %d)\n",
 				used, total);
 			return -1;
@@ -88,7 +88,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		err = fdt_replace_reservemap_entry(fdt, j,
 			initrd_start, initrd_end - initrd_start + 1);
 		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_chosen: %s\n", fdt_strerror(err));
 			return err;
 		}
 	}
@@ -114,8 +114,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		 */
 		nodeoffset = fdt_add_subnode(fdt, 0, "chosen");
 		if (nodeoffset < 0) {
-			printf("WARNING fdt_chosen: "
-				"could not create the /chosen node (%s).\n",
+			printf("WARNING: could not create /chosen %s.\n",
 				fdt_strerror(nodeoffset));
 			return nodeoffset;
 		}
@@ -129,8 +128,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		err = fdt_setprop(fdt, nodeoffset,
 			"bootargs", str, strlen(str)+1);
 		if (err < 0)
-			printf("WARNING fdt_chosen: "
-				"could not set bootargs (%s).\n",
+			printf("WARNING: could not set bootargs %s.\n",
 				fdt_strerror(err));
 	}
 	if (initrd_start && initrd_end) {
@@ -138,23 +136,21 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong initrd_end, int force)
 		err = fdt_setprop(fdt, nodeoffset,
 			 "linux,initrd-start", &tmp, sizeof(tmp));
 		if (err < 0)
-			printf("WARNING fdt_chosen: "
-				"could not set linux,initrd-start (%s).\n",
+			printf("WARNING: "
+				"could not set linux,initrd-start %s.\n",
 				fdt_strerror(err));
 		tmp = __cpu_to_be32(initrd_end);
 		err = fdt_setprop(fdt, nodeoffset,
 			"linux,initrd-end", &tmp, sizeof(tmp));
 		if (err < 0)
-			printf("WARNING fdt_chosen: "
-				"could not set linux,initrd-end (%s).\n",
+			printf("WARNING: could not set linux,initrd-end %s.\n",
 				fdt_strerror(err));
 	}
 #ifdef OF_STDOUT_PATH
 	err = fdt_setprop(fdt, nodeoffset,
 		"linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
 	if (err < 0)
-		printf("WARNING fdt_chosen: "
-			"could not set linux,stdout-path (%s).\n",
+		printf("WARNING: could not set linux,stdout-path %s.\n",
 			fdt_strerror(err));
 #endif
 
@@ -179,7 +175,7 @@ int fdt_env(void *fdt)
 
 	err = fdt_check_header(fdt);
 	if (err < 0) {
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("fdt_env: %s\n", fdt_strerror(err));
 		return err;
 	}
 
@@ -191,7 +187,7 @@ int fdt_env(void *fdt)
 	if (nodeoffset >= 0) {
 		err = fdt_del_node(fdt, nodeoffset);
 		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_env: %s\n", fdt_strerror(err));
 			return err;
 		}
 	}
@@ -200,8 +196,7 @@ int fdt_env(void *fdt)
 	 */
 	nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env");
 	if (nodeoffset < 0) {
-		printf("WARNING fdt_env: "
-			"could not create the /u-boot-env node (%s).\n",
+		printf("WARNING: could not create /u-boot-env %s.\n",
 			fdt_strerror(nodeoffset));
 		return nodeoffset;
 	}
@@ -230,8 +225,7 @@ int fdt_env(void *fdt)
 			continue;
 		err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1);
 		if (err < 0) {
-			printf("WARNING fdt_env: "
-				"could not set %s (%s).\n",
+			printf("WARNING: could not set %s %s.\n",
 				lval, fdt_strerror(err));
 			return err;
 		}
@@ -303,7 +297,7 @@ int fdt_bd_t(void *fdt)
 
 	err = fdt_check_header(fdt);
 	if (err < 0) {
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("fdt_bd_t: %s\n", fdt_strerror(err));
 		return err;
 	}
 
@@ -315,7 +309,7 @@ int fdt_bd_t(void *fdt)
 	if (nodeoffset >= 0) {
 		err = fdt_del_node(fdt, nodeoffset);
 		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_bd_t: %s\n", fdt_strerror(err));
 			return err;
 		}
 	}
@@ -324,10 +318,9 @@ int fdt_bd_t(void *fdt)
 	 */
 	nodeoffset = fdt_add_subnode(fdt, 0, "bd_t");
 	if (nodeoffset < 0) {
-		printf("WARNING fdt_bd_t: "
-			"could not create the /bd_t node (%s).\n",
+		printf("WARNING: could not create /bd_t %s.\n",
 			fdt_strerror(nodeoffset));
-		printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+		printf("fdt_bd_t: %s\n", fdt_strerror(nodeoffset));
 		return nodeoffset;
 	}
 	/*
@@ -338,8 +331,7 @@ int fdt_bd_t(void *fdt)
 		err = fdt_setprop(fdt, nodeoffset,
 			bd_map[i].name, &tmp, sizeof(tmp));
 		if (err < 0)
-			printf("WARNING fdt_bd_t: "
-				"could not set %s (%s).\n",
+			printf("WARNING: could not set %s %s.\n",
 				bd_map[i].name, fdt_strerror(err));
 	}
 	/*
@@ -347,13 +339,11 @@ int fdt_bd_t(void *fdt)
 	 */
 	err = fdt_setprop(fdt, nodeoffset, "enetaddr", &bd->bi_enetaddr, 6);
 	if (err < 0)
-		printf("WARNING fdt_bd_t: "
-			"could not set enetaddr (%s).\n",
+		printf("WARNING: could not set enetaddr %s.\n",
 			fdt_strerror(err));
 	err = fdt_setprop(fdt, nodeoffset, "ethspeed", &bd->bi_ethspeed, 4);
 	if (err < 0)
-		printf("WARNING fdt_bd_t: "
-			"could not set ethspeed (%s).\n",
+		printf("WARNING: could not set ethspeed %s.\n",
 			fdt_strerror(err));
 	return 0;
 }
-- 
1.4.4.4

^ permalink raw reply related	[flat|nested] 7+ messages in thread
* [U-Boot-Users] [PATCH: u-boot-fdt] Improve error print messages.
@ 2007-08-07 16:06 Jerry Van Baren
  2007-08-07 20:29 ` Kim Phillips
  2007-08-09 21:05 ` Wolfgang Denk
  0 siblings, 2 replies; 7+ messages in thread
From: Jerry Van Baren @ 2007-08-07 16:06 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Gerald Van Baren <vanbaren@cideas.com>
---

The American expression is "polishing the turd"...  :-)

  common/fdt_support.c |   62 
+++++++++++++++++++++++++-------------------------
  1 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/common/fdt_support.c b/common/fdt_support.c
index 259bd42..b4dba2b 100644
--- a/common/fdt_support.c
+++ b/common/fdt_support.c
@@ -54,7 +54,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong 
initrd_end, int force)

  	err = fdt_check_header(fdt);
  	if (err < 0) {
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("fdt_chosen: %s\n", fdt_strerror(err));
  		return err;
  	}

@@ -66,11 +66,11 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong 
initrd_end, int force)

  		err = fdt_num_reservemap(fdt, &used, &total);
  		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_chosen: %s\n", fdt_strerror(err));
  			return err;
  		}
  		if (used >= total) {
-			printf("WARNING fdt_chosen: "
+			printf("WARNING: "
  				"no room in the reserved map (%d of %d)\n",
  				used, total);
  			return -1;
@@ -88,7 +88,7 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong 
initrd_end, int force)
  		err = fdt_replace_reservemap_entry(fdt, j,
  			initrd_start, initrd_end - initrd_start + 1);
  		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_chosen: %s\n", fdt_strerror(err));
  			return err;
  		}
  	}
@@ -114,8 +114,8 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong 
initrd_end, int force)
  		 */
  		nodeoffset = fdt_add_subnode(fdt, 0, "chosen");
  		if (nodeoffset < 0) {
-			printf("WARNING fdt_chosen: "
-				"could not create the /chosen node (%s).\n",
+			printf("WARNING: "
+				"could not create the /chosen node %s.\n",
  				fdt_strerror(nodeoffset));
  			return nodeoffset;
  		}
@@ -129,8 +129,8 @@ int fdt_chosen(void *fdt, ulong initrd_start, ulong 
initrd_end, int force)
  		err = fdt_setprop(fdt, nodeoffset,
  			"bootargs", str, strlen(str)+1);
  		if (err < 0)
-			printf("WARNING fdt_chosen: "
-				"could not set bootargs (%s).\n",
+			printf("WARNING: "
+				"could not set bootargs %s.\n",
  				fdt_strerror(err));
  	}
  	if (initrd_start && initrd_end) {
@@ -138,23 +138,23 @@ int fdt_chosen(void *fdt, ulong initrd_start, 
ulong initrd_end, int force)
  		err = fdt_setprop(fdt, nodeoffset,
  			 "linux,initrd-start", &tmp, sizeof(tmp));
  		if (err < 0)
-			printf("WARNING fdt_chosen: "
-				"could not set linux,initrd-start (%s).\n",
+			printf("WARNING: "
+				"could not set linux,initrd-start %s.\n",
  				fdt_strerror(err));
  		tmp = __cpu_to_be32(initrd_end);
  		err = fdt_setprop(fdt, nodeoffset,
  			"linux,initrd-end", &tmp, sizeof(tmp));
  		if (err < 0)
-			printf("WARNING fdt_chosen: "
-				"could not set linux,initrd-end (%s).\n",
+			printf("WARNING: "
+				"could not set linux,initrd-end %s.\n",
  				fdt_strerror(err));
  	}
  #ifdef OF_STDOUT_PATH
  	err = fdt_setprop(fdt, nodeoffset,
  		"linux,stdout-path", OF_STDOUT_PATH, strlen(OF_STDOUT_PATH)+1);
  	if (err < 0)
-		printf("WARNING fdt_chosen: "
-			"could not set linux,stdout-path (%s).\n",
+		printf("WARNING: "
+			"could not set linux,stdout-path %s.\n",
  			fdt_strerror(err));
  #endif

@@ -179,7 +179,7 @@ int fdt_env(void *fdt)

  	err = fdt_check_header(fdt);
  	if (err < 0) {
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("fdt_env: %s\n", fdt_strerror(err));
  		return err;
  	}

@@ -191,7 +191,7 @@ int fdt_env(void *fdt)
  	if (nodeoffset >= 0) {
  		err = fdt_del_node(fdt, nodeoffset);
  		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_env: %s\n", fdt_strerror(err));
  			return err;
  		}
  	}
@@ -200,8 +200,8 @@ int fdt_env(void *fdt)
  	 */
  	nodeoffset = fdt_add_subnode(fdt, 0, "u-boot-env");
  	if (nodeoffset < 0) {
-		printf("WARNING fdt_env: "
-			"could not create the /u-boot-env node (%s).\n",
+		printf("WARNING: "
+			"could not create the /u-boot-env node %s.\n",
  			fdt_strerror(nodeoffset));
  		return nodeoffset;
  	}
@@ -230,8 +230,8 @@ int fdt_env(void *fdt)
  			continue;
  		err = fdt_setprop(fdt, nodeoffset, lval, rval, strlen(rval)+1);
  		if (err < 0) {
-			printf("WARNING fdt_env: "
-				"could not set %s (%s).\n",
+			printf("WARNING: "
+				"could not set %s %s.\n",
  				lval, fdt_strerror(err));
  			return err;
  		}
@@ -303,7 +303,7 @@ int fdt_bd_t(void *fdt)

  	err = fdt_check_header(fdt);
  	if (err < 0) {
-		printf("libfdt: %s\n", fdt_strerror(err));
+		printf("fdt_bd_t: %s\n", fdt_strerror(err));
  		return err;
  	}

@@ -315,7 +315,7 @@ int fdt_bd_t(void *fdt)
  	if (nodeoffset >= 0) {
  		err = fdt_del_node(fdt, nodeoffset);
  		if (err < 0) {
-			printf("libfdt: %s\n", fdt_strerror(err));
+			printf("fdt_bd_t: %s\n", fdt_strerror(err));
  			return err;
  		}
  	}
@@ -324,10 +324,10 @@ int fdt_bd_t(void *fdt)
  	 */
  	nodeoffset = fdt_add_subnode(fdt, 0, "bd_t");
  	if (nodeoffset < 0) {
-		printf("WARNING fdt_bd_t: "
-			"could not create the /bd_t node (%s).\n",
+		printf("WARNING: "
+			"could not create the /bd_t node %s.\n",
  			fdt_strerror(nodeoffset));
-		printf("libfdt: %s\n", fdt_strerror(nodeoffset));
+		printf("fdt_bd_t: %s\n", fdt_strerror(nodeoffset));
  		return nodeoffset;
  	}
  	/*
@@ -338,8 +338,8 @@ int fdt_bd_t(void *fdt)
  		err = fdt_setprop(fdt, nodeoffset,
  			bd_map[i].name, &tmp, sizeof(tmp));
  		if (err < 0)
-			printf("WARNING fdt_bd_t: "
-				"could not set %s (%s).\n",
+			printf("WARNING: "
+				"could not set %s %s.\n",
  				bd_map[i].name, fdt_strerror(err));
  	}
  	/*
@@ -347,13 +347,13 @@ int fdt_bd_t(void *fdt)
  	 */
  	err = fdt_setprop(fdt, nodeoffset, "enetaddr", &bd->bi_enetaddr, 6);
  	if (err < 0)
-		printf("WARNING fdt_bd_t: "
-			"could not set enetaddr (%s).\n",
+		printf("WARNING: "
+			"could not set enetaddr %s.\n",
  			fdt_strerror(err));
  	err = fdt_setprop(fdt, nodeoffset, "ethspeed", &bd->bi_ethspeed, 4);
  	if (err < 0)
-		printf("WARNING fdt_bd_t: "
-			"could not set ethspeed (%s).\n",
+		printf("WARNING: "
+			"could not set ethspeed %s.\n",
  			fdt_strerror(err));
  	return 0;
  }
-- 
1.4.4.4

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

end of thread, other threads:[~2007-08-09 21:05 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-08-08  1:26 [U-Boot-Users] [PATCH: u-boot-fdt] Improve error print messages Jerry Van Baren
  -- strict thread matches above, loose matches on Subject: below --
2007-08-07 16:06 Jerry Van Baren
2007-08-07 20:29 ` Kim Phillips
2007-08-08  7:15   ` Michal Simek
2007-08-08 12:50     ` Jerry Van Baren
2007-08-08 13:38       ` Michal Simek
2007-08-09 21:05 ` Wolfgang Denk

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