[U-Boot-Users] [PATCH] Fix possible uninitialized variable compiler warning.

Matthew McClintock msm at freescale.com
Wed Oct 11 23:02:28 CEST 2006


On Tue, 2006-10-10 at 00:23 -0600, Grant Likely wrote:
> This patch applies against the u-boot tree at
> git://www.jdl.com/software/u-boot-86xx.git
> 
> When CONFIG_OF_FLAG_TREE is set, the compiler complains that 'len' in
> do_bootm_linux() may be uninitialized.  There is no possibility in the
> current code that len will get used uninitialized, but this fix follows
> the existing convention of setting both len and data to zero at the same
> time.
> 
> Signed-off-by: Grant Likely <grant.likely at secretlab.ca>
> ---
>  common/cmd_bootm.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/common/cmd_bootm.c b/common/cmd_bootm.c
> index 652d843..af949a3 100644
> --- a/common/cmd_bootm.c
> +++ b/common/cmd_bootm.c
> @@ -623,7 +623,7 @@ #ifdef CONFIG_OF_FLAT_TREE
>  	/* Look for a '-' which indicates to ignore the ramdisk argument */
>  	if (argc >= 3 && strcmp(argv[2], "-") ==  0) {
>  			debug ("Skipping initrd\n");
> -			data = 0;
> +			len = data = 0;
>  		}
>  	else
>  #endif

I just checked in a patch which fixes a lot of compiler warnings
including this one. Again, the tree lives at:

http://opensource.freescale.com/pub/scm/u-boot-85xx.git

Thanks Grant.

-Matthew





More information about the U-Boot mailing list