aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Crosthwaite <peter.crosthwaite@xilinx.com>2014-05-12 01:13:47 -0700
committerPaolo Bonzini <pbonzini@redhat.com>2014-06-17 16:07:37 +0200
commit3fb5bf5730b90c08d5d1c027900efae210d9b326 (patch)
tree735802368f31f36bab4705648d38479b156d4e12
parent4dc56152237f61694fa42675a78ffd14a509df98 (diff)
memory: Simplify mr_add_subregion() if-else
This if else is not needed. The previous call to memory_region_add (whether _overlap or not) will always set priority and may_overlap to desired values. And its not possible to get here without having called memory_region_add_subregion due to the null guard on parent. So we can just directly call memory_region_add_subregion_common. Signed-off-by: Peter Crosthwaite <peter.crosthwaite@xilinx.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
-rw-r--r--memory.c8
1 files changed, 1 insertions, 7 deletions
diff --git a/memory.c b/memory.c
index 829d56db37..3811bd16f2 100644
--- a/memory.c
+++ b/memory.c
@@ -1514,8 +1514,6 @@ void memory_region_set_enabled(MemoryRegion *mr, bool enabled)
void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
{
MemoryRegion *parent = mr->parent;
- int priority = mr->priority;
- bool may_overlap = mr->may_overlap;
if (addr == mr->addr || !parent) {
mr->addr = addr;
@@ -1525,11 +1523,7 @@ void memory_region_set_address(MemoryRegion *mr, hwaddr addr)
memory_region_transaction_begin();
memory_region_ref(mr);
memory_region_del_subregion(parent, mr);
- if (may_overlap) {
- memory_region_add_subregion_overlap(parent, addr, mr, priority);
- } else {
- memory_region_add_subregion(parent, addr, mr);
- }
+ memory_region_add_subregion_common(parent, addr, mr);
memory_region_unref(mr);
memory_region_transaction_commit();
}