From 999dd8905ad3f3889438a3784e3fc03e791ac2d5 Mon Sep 17 00:00:00 2001 From: Yidi Lin Date: Sat, 3 Jan 2026 11:33:45 +0800 Subject: [PATCH] lib/bootmem: Replace conditional return with assert in bootmem_add_range_from Promote the condition where new_tag equals from_tag from a runtime error to an assertion, indicating it as a critical programming error that should not occur. Change-Id: I1fe93b7ee0593d27f70ab3702ad4feae85857ea3 Signed-off-by: Yidi Lin Reviewed-on: https://review.coreboot.org/c/coreboot/+/90678 Reviewed-by: Yu-Ping Wu Tested-by: build bot (Jenkins) --- src/lib/bootmem.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/lib/bootmem.c b/src/lib/bootmem.c index 416f1287c6..b6be5820d2 100644 --- a/src/lib/bootmem.c +++ b/src/lib/bootmem.c @@ -144,8 +144,7 @@ void bootmem_add_range(uint64_t start, uint64_t size, int bootmem_add_range_from(uint64_t start, uint64_t size, const enum bootmem_type new_tag, const enum bootmem_type from_tag) { - if (new_tag == from_tag) - return -1; + assert(new_tag != from_tag); if (!bootmem_region_targets_type(start, size, from_tag)) { printk(BIOS_ERR, "%s: Failed to add the range [%#llx, %#llx)"