All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lokesh Vutla <lokeshvutla@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/3] tools: dumpimage: Provide more feedback on internal errors
Date: Thu, 14 Nov 2019 17:16:00 +0530	[thread overview]
Message-ID: <ad0aa8f0-8235-bcb8-471c-88b48bd29ab4@ti.com> (raw)
In-Reply-To: <20190917210935.3666-1-afd@ti.com>



On 18/09/19 2:39 AM, Andrew F. Davis wrote:
> The dumpimage utility errors out in a number of places without providing
> sufficient feedback to allow the user to easily determine what has gone
> wrong. Add additional error messages to make the cause of the failure
> more obvious.
> 
> Signed-off-by: Andrew F. Davis <afd@ti.com>

Reviewed-by: Lokesh Vutla <lokeshvutla@ti.com>

Thanks and regards,
Lokesh

> ---
>  tools/dumpimage.c | 14 +++++++++++++-
>  1 file changed, 13 insertions(+), 1 deletion(-)
> 
> diff --git a/tools/dumpimage.c b/tools/dumpimage.c
> index ee3d41dda4..d5f893daf1 100644
> --- a/tools/dumpimage.c
> +++ b/tools/dumpimage.c
> @@ -35,14 +35,23 @@ static int dumpimage_extract_subimage(struct image_type_params *tparams,
>  	if (tparams->verify_header) {
>  		retval = tparams->verify_header((unsigned char *)ptr,
>  				sbuf->st_size, &params);
> -		if (retval != 0)
> +		if (retval != 0) {
> +			fprintf(stderr, "%s: failed to verify header of %s\n",
> +				params.cmdname, tparams->name);
>  			return -1;
> +		}
> +
>  		/*
>  		 * Extract the file from the image
>  		 * if verify is successful
>  		 */
>  		if (tparams->extract_subimage) {
>  			retval = tparams->extract_subimage(ptr, &params);
> +			if (retval != 0) {
> +				fprintf(stderr, "%s: extract_subimage failed for %s\n",
> +					params.cmdname, tparams->name);
> +				return -3;
> +			}
>  		} else {
>  			fprintf(stderr,
>  				"%s: extract_subimage undefined for %s\n",
> @@ -175,6 +184,9 @@ int main(int argc, char **argv)
>  		 * image type. Returns the error code if not matched
>  		 */
>  		retval = dumpimage_extract_subimage(tparams, ptr, &sbuf);
> +		if (retval)
> +			fprintf(stderr, "%s: Can't extract subimage from %s\n",
> +				params.cmdname, params.imagefile);
>  	} else {
>  		/*
>  		 * Print the image information for matched image type
> 

  parent reply	other threads:[~2019-11-14 11:46 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-17 21:09 [U-Boot] [PATCH 1/3] tools: dumpimage: Provide more feedback on internal errors Andrew F. Davis
2019-09-17 21:09 ` [U-Boot] [PATCH 2/3] tools: fit_image: Use fit_image_get_data_and_size for getting offset/size Andrew F. Davis
2019-11-14 11:46   ` Lokesh Vutla
2020-01-08 20:10   ` Tom Rini
2019-09-17 21:09 ` [U-Boot] [PATCH 3/3] tools: dumpimage: Fall-though to print usage for help command Andrew F. Davis
2019-11-14 11:46   ` Lokesh Vutla
2020-01-08 20:10   ` Tom Rini
2019-11-13 16:14 ` [U-Boot] [PATCH 1/3] tools: dumpimage: Provide more feedback on internal errors Andrew F. Davis
2020-01-07 14:07   ` Andrew F. Davis
2019-11-14 11:46 ` Lokesh Vutla [this message]
2020-01-08 20:10 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ad0aa8f0-8235-bcb8-471c-88b48bd29ab4@ti.com \
    --to=lokeshvutla@ti.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.