From 623f842058e343204073849a5c0e8bff9c35e974 Mon Sep 17 00:00:00 2001 From: Simon Horman Date: Fri, 22 Sep 2006 16:45:33 +0900 Subject: kexec-ktools: simplify segment walk logic in patch_efi_memmap() There is a farily complex if, for construct in patch_efi_memmap(), that seems to be simplifyable to a somewhat simpler while statement. Note that this does change the logic statement. In particular the original code has if (seg->end < mend) towards the end, and the new code effectively replaces this with if (seg->end <= mend). However, in the original code this is copled with a separate if (seg->end > mend) check at the begining, so I believe that this is actually a minor (possibly never seen) logic error in the original code. The node code just always checks (seg->end > mend). Signed-Off-By: Simon Horman --- purgatory/arch/ia64/purgatory-ia64.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/purgatory/arch/ia64/purgatory-ia64.c b/purgatory/arch/ia64/purgatory-ia64.c index 8004aab..977ec7c 100644 --- a/purgatory/arch/ia64/purgatory-ia64.c +++ b/purgatory/arch/ia64/purgatory-ia64.c @@ -180,18 +180,12 @@ patch_efi_memmap(struct kexec_boot_params *params, if (seg->start < mstart || seg->start >= mend) continue; - if (seg->end > mend) { + while (seg->end > mend && p1 < src_end) { p1 += memdesc_size; - for(; p1 < src_end; p1 += memdesc_size) { - md1 = p1; - /* TODO check contig and - attribute here */ - mend = md1->phys_addr - + (md1->num_pages << - EFI_PAGE_SHIFT); - if (seg->end < mend) - break; - } + md1 = p1; + /* TODO check contig and attribute here */ + mend = md1->phys_addr + + (md1->num_pages << EFI_PAGE_SHIFT); } start_pages = (seg->start - mstart) >> EFI_PAGE_SHIFT; mid_pages = (seg->end - seg->start) >> EFI_PAGE_SHIFT; -- cgit