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 <yidilin@google.com>
Reviewed-on: https://review.coreboot.org/c/coreboot/+/90678
Reviewed-by: Yu-Ping Wu <yupingso@google.com>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
This commit is contained in:
Yidi Lin 2026-01-03 11:33:45 +08:00 committed by Matt DeVillier
commit 999dd8905a

View file

@ -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)"