summaryrefslogtreecommitdiff
path: root/util/cbfstool
diff options
context:
space:
mode:
Diffstat (limited to 'util/cbfstool')
-rw-r--r--util/cbfstool/cbfstool.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/util/cbfstool/cbfstool.c b/util/cbfstool/cbfstool.c
index b6a486fd37..6a89476da7 100644
--- a/util/cbfstool/cbfstool.c
+++ b/util/cbfstool/cbfstool.c
@@ -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);