cbfstool: test for duplicate files earlier
No need to read the file before bailing out. Change-Id: Ida7226c6ec227e1105724cdb1e5a0927217a69c7 Signed-off-by: Patrick Georgi <pgeorgi@google.com> Reviewed-on: http://review.coreboot.org/11212 Tested-by: build bot (Jenkins) Reviewed-by: Aaron Durbin <adurbin@chromium.org>
This commit is contained in:
parent
c6a8da7f93
commit
4e54bf9334
|
@ -190,6 +190,11 @@ static int cbfs_add_component(const char *filename,
|
|||
if (cbfs_image_from_buffer(&image, param.image_region, headeroffset))
|
||||
return 1;
|
||||
|
||||
if (cbfs_get_entry(&image, name)) {
|
||||
ERROR("'%s' already in ROM image.\n", name);
|
||||
return 1;
|
||||
}
|
||||
|
||||
struct buffer buffer;
|
||||
if (buffer_from_file(&buffer, filename) != 0) {
|
||||
ERROR("Could not load file '%s'.\n", filename);
|
||||
|
@ -202,12 +207,6 @@ static int cbfs_add_component(const char *filename,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (cbfs_get_entry(&image, name)) {
|
||||
ERROR("'%s' already in ROM image.\n", name);
|
||||
buffer_delete(&buffer);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (IS_TOP_ALIGNED_ADDRESS(offset))
|
||||
offset = convert_to_from_top_aligned(param.image_region,
|
||||
-offset);
|
||||
|
|
Loading…
Reference in New Issue