fiptool: simplify assert() for add_image(_desc)
lookup_image(_desc)_from_uuid() traverses the linked list, so it
is not efficient. We just want to make sure *p points to NULL here.
Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
diff --git a/tools/fiptool/fiptool.c b/tools/fiptool/fiptool.c
index b79c0d6..7a5c2cd 100644
--- a/tools/fiptool/fiptool.c
+++ b/tools/fiptool/fiptool.c
@@ -202,11 +202,10 @@
{
image_desc_t **p = &image_desc_head;
- assert(lookup_image_desc_from_uuid(&desc->uuid) == NULL);
-
while (*p)
p = &(*p)->next;
+ assert(*p == NULL);
*p = desc;
nr_image_descs++;
}
@@ -244,11 +243,10 @@
{
image_t **p = &image_head;
- assert(lookup_image_from_uuid(&image->uuid) == NULL);
-
while (*p)
p = &(*p)->next;
+ assert(*p == NULL);
*p = image;
nr_images++;