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

Simon Glass
2013-01-05T21:51:38Z

Hi Marek,

On Sat, Jan 5, 2013 at 12:24 AM, Marek Vasut <marex@denx.de> wrote:
> Dear Simon Glass,
>
>> The fit_handle_file() function is quiet long
>
> quite ;-)

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?

Because the blob gets updated (e.g. by writing hashes to the FIT). I
will add a comment.

>
> otherwise
>
> Reviewed-by: Marek Vasut <marex@denx.de>
>
> Best regards,
> Marek Vasut

Regards,
Simon