aboutsummaryrefslogtreecommitdiff
path: root/memory.c
diff options
context:
space:
mode:
authorPeter Xu <peterx@redhat.com>2019-08-20 22:13:27 +0800
committerPaolo Bonzini <pbonzini@redhat.com>2019-08-21 16:31:58 +0200
commit9c1aa1c235c770d84462d482460a96e957e95b9c (patch)
treeb9ff3bafe7bcb6152a2923339e1e157c832fcfb4 /memory.c
parentc5b35f03c3fcb8c8e0c6efc50f3a9e70dc028c00 (diff)
downloadqemu-9c1aa1c235c770d84462d482460a96e957e95b9c.zip
qemu-9c1aa1c235c770d84462d482460a96e957e95b9c.tar.gz
qemu-9c1aa1c235c770d84462d482460a96e957e95b9c.tar.bz2
memory: Refactor memory_region_clear_coalescing
Removing the update variable and quit earlier if the memory region has no coalesced range. This prepares for the next patch. Fixes: 3ac7d43a6fbb5d4a3 Signed-off-by: Peter Xu <peterx@redhat.com> Message-Id: <20190820141328.10009-4-peterx@redhat.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'memory.c')
-rw-r--r--memory.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/memory.c b/memory.c
index 4aa38eb..9a1193a 100644
--- a/memory.c
+++ b/memory.c
@@ -2281,7 +2281,10 @@ void memory_region_add_coalescing(MemoryRegion *mr,
void memory_region_clear_coalescing(MemoryRegion *mr)
{
CoalescedMemoryRange *cmr;
- bool updated = false;
+
+ if (QTAILQ_EMPTY(&mr->coalesced)) {
+ return;
+ }
qemu_flush_coalesced_mmio_buffer();
mr->flush_coalesced_mmio = false;
@@ -2290,12 +2293,9 @@ void memory_region_clear_coalescing(MemoryRegion *mr)
cmr = QTAILQ_FIRST(&mr->coalesced);
QTAILQ_REMOVE(&mr->coalesced, cmr, link);
g_free(cmr);
- updated = true;
}
- if (updated) {
- memory_region_update_coalesced_range(mr);
- }
+ memory_region_update_coalesced_range(mr);
}
void memory_region_set_flush_coalesced(MemoryRegion *mr)