[i386]: Return an error if the e820 detection goes bad From: Jordan Crouse Change the e820 code to always return an error if something bad happens while reading the e820 map. This matches the old code behavior, and allows brain-dead e820 implementations to still work. Signed-off-by: Jordan Crouse --- arch/i386/boot/memory.c | 9 +++++---- 1 files changed, 5 insertions(+), 4 deletions(-) diff --git a/arch/i386/boot/memory.c b/arch/i386/boot/memory.c index 1a2e62d..4c7f0f6 100644 --- a/arch/i386/boot/memory.c +++ b/arch/i386/boot/memory.c @@ -22,7 +22,7 @@ static int detect_memory_e820(void) { u32 next = 0; u32 size, id; - u8 err; + u8 err, count = 0; struct e820entry *desc = boot_params.e820_map; do { @@ -34,13 +34,14 @@ static int detect_memory_e820(void) : "D" (desc), "a" (0xe820)); if (err || id != SMAP) - break; + return -1; - boot_params.e820_entries++; + count++; desc++; } while (next && boot_params.e820_entries < E820MAX); - return boot_params.e820_entries; + boot_params.e820_entries = count; + return count; } static int detect_memory_e801(void)