diff mbox series

[07/15] libflash/libffs: Always add entries to the end of the TOC

Message ID 20180315055827.8999-8-cyril.bur@au1.ibm.com
State Accepted
Headers show
Series libffs and ffspart rework | expand

Commit Message

Cyril Bur March 15, 2018, 5:58 a.m. UTC
It turns out that sorted order isn't the best idea. This removes
flexibility from the caller. If the user wants their partitions in
sorted order, they should insert them in sorted order.

Signed-off-by: Cyril Bur <cyril.bur@au1.ibm.com>
---
 libflash/libffs.c | 20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)
diff mbox series

Patch

diff --git a/libflash/libffs.c b/libflash/libffs.c
index 4f1852ff..e115e427 100644
--- a/libflash/libffs.c
+++ b/libflash/libffs.c
@@ -610,25 +610,7 @@  static int __ffs_entry_add(struct ffs_hdr *hdr, struct ffs_entry *entry)
 		return FFS_ERR_BAD_PART_BASE;
 	}
 
-	/*
-	 * A header can't have zero entries. Was asserted.
-	 */
-	list_for_each(&hdr->entries, ent, list)
-		if (entry->base < ent->base)
-			break;
-
-	if (ent == list_top(&hdr->entries, struct ffs_entry, list)) {
-		/*
-		 * This should never happen because the partition entry
-		 * should ALWAYS be here
-		 */
-		fprintf(stderr, "Warning: replacing first entry in FFS header\n");
-		list_add(&hdr->entries, &entry->list);
-	} else if (!ent) {
-		list_add_tail(&hdr->entries, &entry->list);
-	} else {
-		list_add_before(&hdr->entries, &entry->list, &ent->list);
-	}
+	list_add_tail(&hdr->entries, &entry->list);
 
 	return 0;
 }