x86: pat.c final cleanup of loop body in reserve_memtype
authorAndreas Herrmann <andreas.herrmann3@amd.com>
Fri, 20 Jun 2008 20:08:37 +0000 (22:08 +0200)
committerIngo Molnar <mingo@elte.hu>
Tue, 24 Jun 2008 11:05:59 +0000 (13:05 +0200)
Signed-off-by: Andreas Herrmann <andreas.herrmann3@amd.com>
Cc: Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
Cc: Suresh B Siddha <suresh.b.siddha@intel.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
arch/x86/mm/pat.c

index 281ac6489c08a720e5490b7b6f1f4a17871702f6..a885a1019b8a6908f08e7481a5724daa5ecde273 100644 (file)
@@ -281,32 +281,24 @@ int reserve_memtype(u64 start, u64 end, unsigned long req_type,
        /* Search for existing mapping that overlaps the current range */
        where = NULL;
        list_for_each_entry(entry, &memtype_list, nd) {
-               if (entry->start >= end) {
+               if (end <= entry->start) {
                        where = entry->nd.prev;
                        break;
-               }
-
-               if (start <= entry->start && end >= entry->start) {
+               } else if (start <= entry->start) { /* end > entry->start */
                        err = chk_conflict(new, entry, new_type);
-                       if (err) {
-                               break;
+                       if (!err) {
+                               dprintk("Overlap at 0x%Lx-0x%Lx\n",
+                                       entry->start, entry->end);
+                               where = entry->nd.prev;
                        }
-
-                       dprintk("Overlap at 0x%Lx-0x%Lx\n",
-                              entry->start, entry->end);
-                       where = entry->nd.prev;
                        break;
-               }
-
-               if (start < entry->end) {
+               } else if (start < entry->end) { /* start > entry->start */
                        err = chk_conflict(new, entry, new_type);
-                       if (err) {
-                               break;
+                       if (!err) {
+                               dprintk("Overlap at 0x%Lx-0x%Lx\n",
+                                       entry->start, entry->end);
+                               where = &entry->nd;
                        }
-
-                       dprintk("Overlap at 0x%Lx-0x%Lx\n",
-                                entry->start, entry->end);
-                       where = &entry->nd;
                        break;
                }
        }