[PATCH 7/7] x86: pat.c final cleanup of loop body inreserve_memtype
From: Andreas Herrmann
Date: Fri Jun 20 2008 - 16:09:05 EST
Signed-off-by: Andreas Herrmann <andreas.herrmann3@xxxxxxx>
---
arch/x86/mm/pat.c | 30 +++++++++++-------------------
1 files changed, 11 insertions(+), 19 deletions(-)
diff --git a/arch/x86/mm/pat.c b/arch/x86/mm/pat.c
index 281ac64..a885a10 100644
--- a/arch/x86/mm/pat.c
+++ b/arch/x86/mm/pat.c
@@ -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;
}
}
--
1.5.5.4
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/