summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Horman <horms@verge.net.au>2006-09-22 16:45:33 +0900
committerSimon Horman <horms@verge.net.au>2006-10-06 12:46:16 +0900
commit623f842058e343204073849a5c0e8bff9c35e974 (patch)
tree4d281583834b7a8026f58577132c5f8374b7da94
parentc506e2859d2b890bd6ada04fa11e434ba5d87b1e (diff)
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 <horms@verge.net.au>
-rw-r--r--purgatory/arch/ia64/purgatory-ia64.c16
1 files 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;