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 <[EMAIL PROTECTED]>

diff --git a/purgatory/arch/ia64/purgatory-ia64.c 
b/purgatory/arch/ia64/purgatory-ia64.c
index 91f5268..2850b12 100644
--- a/purgatory/arch/ia64/purgatory-ia64.c
+++ b/purgatory/arch/ia64/purgatory-ia64.c
@@ -185,18 +185,12 @@ patch_efi_memmap(struct kexec_boot_param
                        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;

--

-- 
Horms
  H: http://www.vergenet.net/~horms/
  W: http://www.valinux.co.jp/en/

_______________________________________________
fastboot mailing list
[email protected]
https://lists.osdl.org/mailman/listinfo/fastboot

Reply via email to