[U-Boot] [PATCH v3] imls: Add support to list images in NAND device

Scott Wood scottwood at freescale.com
Thu Dec 13 22:59:01 CET 2012


On 12/13/2012 04:38:18 AM, Vipin Kumar wrote:
> +		for (off = 0; off < nand->size; off += nand->erasesize)  
> {
> +			const image_header_t *header;
> +			int ret;
> +
> +			if (nand_block_isbad(nand, off))
> +				continue;
> +
> +			len = sizeof(buffer);
> +
> +			ret = nand_read(nand, off, &len, (u8 *)buffer);
> +			if (ret < 0 && ret != -EUCLEAN)
> +				continue;

Might want to make some noise if you get an uncorrectable error.

> +
> +			switch (genimg_get_format(buffer)) {
> +			case IMAGE_FORMAT_LEGACY:
> +				header = (const image_header_t *)buffer;
> +				len = image_get_image_size(header);
> +
> +				ret = nand_imls_legacyimage(nand,  
> nand_dev,
> +						off, len);
> +				if (ret < 0 && ret != -ENOMEM)
> +					return ret;
> +				break;
> +#if defined(CONFIG_FIT)
> +			case IMAGE_FORMAT_FIT:
> +				len = fit_get_size(buffer);
> +				ret = nand_imls_fitimage(nand, nand_dev,
> +						off, len);
> +				if (ret < 0 && ret != -ENOMEM)
> +					return ret;
> +				break;
> +#endif
> +			}

Do you really mean to return from the main imls function just because  
one image has an error?  By "use return" I meant return from the  
subfunction.

-Scott


More information about the U-Boot mailing list