[U-Boot] [RFC PATCH 35/44] mkimage: Put FIT loading in function and tidy error handling

Marek Vasut
2013-01-05T08:24:10Z

Dear Simon Glass,

> The fit_handle_file() function is quiet long

quite ;-)

> - split out the part that
> loads and checks a FIT into its own function. We will use this
> function for storing public keys into a destination FDT file.
>
> The error handling is currently a bit repetitive - tidy it.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
> tools/fit_image.c | 96
> +++++++++++++++++++++++++++++++--------------------- 1 files changed, 57
> insertions(+), 39 deletions(-)
>
> diff --git a/tools/fit_image.c b/tools/fit_image.c
> index e0675d7..0f619a2 100644
> --- a/tools/fit_image.c
> +++ b/tools/fit_image.c
> @@ -47,6 +47,48 @@ static int fit_check_image_types (uint8_t type)
> return EXIT_FAILURE;
> }
>
> +int mmap_fdt(struct mkimage_params *params, const char *fname, void
> **blobp, + struct stat *sbuf)
> +{
> + void *ptr;
> + int fd;
> +
> + /* load FIT blob into memory */
> + fd = open(fname, O_RDWR|O_BINARY);

Why is it RDWR even?

otherwise

Reviewed-by: Marek Vasut <marex@denx.de>

Best regards,
Marek Vasut