[U-Boot] [PATCH] RAMDISK: Fix unused variable issue caused by raw rd support

Wolfgang Denk wd at denx.de
Fri Mar 30 23:49:04 CEST 2012


Dear Marek Vasut,

In message <1333142566-30899-1-git-send-email-marex at denx.de> you wrote:
> image.c: In function ‘boot_get_ramdisk’:
> image.c:800:8: warning: unused variable ‘end’ [-Wunused-variable]
> 
> Signed-off-by: Marek Vasut <marex at denx.de>
> ---
>  common/image.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/common/image.c b/common/image.c
> index 103e0e6..d55d448 100644
> --- a/common/image.c
> +++ b/common/image.c
> @@ -797,7 +797,6 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
>  	ulong rd_addr, rd_load;
>  	ulong rd_data, rd_len;
>  	const image_header_t *rd_hdr;
> -	char *end;
>  #if defined(CONFIG_FIT)
>  	void		*fit_hdr;
>  	const char	*fit_uname_config = NULL;
> @@ -996,6 +995,7 @@ int boot_get_ramdisk(int argc, char * const argv[], bootm_headers_t *images,
>  #endif
>  		default:
>  #ifdef CONFIG_SUPPORT_RAW_INITRD
> +			char *end;
>  			if (argc >= 3 && (end = strchr(argv[2], ':'))) {

This works only with CONFIG_SUPPORT_RAW_INITRD undefined.

Otherwise you get:

image.c: In function 'boot_get_ramdisk':
image.c:1000: error: expected expression before 'char'
image.c:1001: error: 'end' undeclared (first use in this function)
image.c:1001: error: (Each undeclared identifier is reported only once
image.c:1001: error: for each function it appears in.)


You need braces to start a new block.

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
"In the face of entropy and nothingness, you kind of have to  pretend
it's  not  there  if  you  want  to  keep writing good code."
- Karl Lehenbauer


More information about the U-Boot mailing list