Browse Source

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>
pull/799/head
Masahiro Yamada 8 years ago
parent
commit
e9e0d2877f
  1. 6
      tools/fiptool/fiptool.c

6
tools/fiptool/fiptool.c

@ -202,11 +202,10 @@ static void add_image_desc(image_desc_t *desc)
{
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 @@ static void add_image(image_t *image)
{
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++;

Loading…
Cancel
Save