[U-Boot] [PATCH 1/8] tools: mkimage : bugfix returns correct value for list command

Wolfgang Denk wd at denx.de
Sat Aug 8 00:11:41 CEST 2009


Dear Prafulla Wadaskar,

In message <1248804270-13715-1-git-send-email-prafulla at marvell.com> you wrote:
> List command always return "EXIT_SUCCESS" even in case of
> failure by any means.
> 
> This patch return 0 if list command is sucessful,
> returns negative value reported by check_header functions
> 
> Signed-off-by: Prafulla Wadaskar <prafulla at marvell.com>
> ---
>  tools/mkimage.c |   27 +++++++++++++--------------
>  1 files changed, 13 insertions(+), 14 deletions(-)

Just a minor nitpick:

...
> -		if (fdt_check_header (ptr)) {
> -			/* old-style image */
> -			image_verify_header ((char *)ptr, sbuf.st_size);
> -			image_print_contents ((image_header_t *)ptr);
> -		} else {
> -			/* FIT image */
> +		if (!(retval = fdt_check_header (ptr)))	/* FIT image */
>  			fit_print_contents (ptr);
> -		}
> +		else if (!(retval = image_verify_header (
> +			(char *)ptr, sbuf.st_size))) /* old-style image */
> +			image_print_contents ((image_header_t *)ptr);

The resulting code looks ugly to me. Please write as:


		if (!(retval = fdt_check_header(ptr))) {
			/* FIT image */
			fit_print_contents (ptr);
		} else if (!(retval = image_verify_header((char *)ptr,
							  sbuf.st_size))) {
			/* old-style image */
			image_print_contents ((image_header_t *)ptr);
		}


Thanks.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH,     MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
There is a multi-legged creature crawling on your shoulder.
	-- Spock, "A Taste of Armageddon", stardate 3193.9


More information about the U-Boot mailing list