Patchwork [U-Boot,RFC,13/44] image: Move error! string to common place

login
register
mail settings
Submitter Simon Glass
Date Jan. 5, 2013, 1:51 a.m.
Message ID <1357350734-13737-14-git-send-email-sjg@chromium.org>
Download mbox | patch
Permalink /patch/209600/
State Superseded, archived
Headers show

Comments

Simon Glass - Jan. 5, 2013, 1:51 a.m.
The string " error\n" appears in each error string. Move it out to a
common place.

Signed-off-by: Simon Glass <sjg@chromium.org>
---
 common/image-fit.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)
Marek Vasut - Jan. 5, 2013, 8:11 a.m.
Dear Simon Glass,

> The string " error\n" appears in each error string. Move it out to a
> common place.
> 
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>  common/image-fit.c |   16 ++++++++--------
>  1 files changed, 8 insertions(+), 8 deletions(-)
> 
> diff --git a/common/image-fit.c b/common/image-fit.c
> index 4a78a5c..19942e2 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -867,7 +867,7 @@ static int fit_image_check_hash(const void *fit, int
> noffset, const void *data, *err_msgp = NULL;
> 
>  	if (fit_image_hash_get_algo(fit, noffset, &algo)) {
> -		*err_msgp = " error!\nCan't get hash algo "
> +		*err_msgp = "Can't get hash algo "
>  				"property";

Maybe you can fix how the strings are broken here and all around in half now? 
Otherwise

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut

Patch

diff --git a/common/image-fit.c b/common/image-fit.c
index 4a78a5c..19942e2 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -867,7 +867,7 @@  static int fit_image_check_hash(const void *fit, int noffset, const void *data,
 	*err_msgp = NULL;
 
 	if (fit_image_hash_get_algo(fit, noffset, &algo)) {
-		*err_msgp = " error!\nCan't get hash algo "
+		*err_msgp = "Can't get hash algo "
 				"property";
 		return -1;
 	}
@@ -883,23 +883,23 @@  static int fit_image_check_hash(const void *fit, int noffset, const void *data,
 
 	if (fit_image_hash_get_value(fit, noffset, &fit_value,
 					&fit_value_len)) {
-		*err_msgp = " error!\nCan't get hash value "
+		*err_msgp = "Can't get hash value "
 				"property";
 		return -1;
 	}
 
 	if (calculate_hash(data, size, algo, value,
 				&value_len)) {
-		*err_msgp = " error!\n"
+		*err_msgp = ""
 				"Unsupported hash algorithm";
 		return -1;
 	}
 
 	if (value_len != fit_value_len) {
-		*err_msgp = " error !\nBad hash value len";
+		*err_msgp = "Bad hash value len";
 		return -1;
 	} else if (memcmp(value, fit_value, value_len) != 0) {
-		*err_msgp = " error!\nBad hash value";
+		*err_msgp = "Bad hash value";
 		return -1;
 	}
 
@@ -929,7 +929,7 @@  int fit_image_verify(const void *fit, int image_noffset)
 
 	/* Get image data and data length */
 	if (fit_image_get_data(fit, image_noffset, &data, &size)) {
-		printf("Can't get image data/size\n");
+		err_msg = "Can't get image data/size";
 		return 0;
 	}
 
@@ -955,14 +955,14 @@  int fit_image_verify(const void *fit, int image_noffset)
 	}
 
 	if (noffset == -FDT_ERR_TRUNCATED || noffset == -FDT_ERR_BADSTRUCTURE) {
-		err_msg = " error!\nCorrupted or truncated tree";
+		err_msg = "Corrupted or truncated tree";
 		goto error;
 	}
 
 	return 1;
 
 error:
-	printf("%s for '%s' hash node in '%s' image node\n",
+	printf(" error!\n%s for '%s' hash node in '%s' image node\n",
 			err_msg, fit_get_name(fit, noffset, NULL),
 			fit_get_name(fit, image_noffset, NULL));
 	return 0;