[7/8] target/i386: Use memory_region_add_subregion() when priority is 0
diff mbox series

Message ID 20191214155614.19004-8-philmd@redhat.com
State New
Headers show
Series
  • Simplify memory_region_add_subregion_overlap(..., priority=0)
Related show

Commit Message

Philippe Mathieu-Daudé Dec. 14, 2019, 3:56 p.m. UTC
It is pointless to overlap a memory subregion with priority 0.
Use the simpler memory_region_add_subregion() function.

This patch was produced with the following spatch script:

    @@
    expression region;
    expression offset;
    expression subregion;
    @@
    -memory_region_add_subregion_overlap(region, offset, subregion, 0)
    +memory_region_add_subregion(region, offset, subregion)

Signed-off-by: Philippe Mathieu-Daudé <philmd@redhat.com>
---
 target/i386/cpu.c | 2 +-
 target/i386/kvm.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

Patch
diff mbox series

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 69f518a21a..6131c62f9d 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -6483,7 +6483,7 @@  static void x86_cpu_realizefn(DeviceState *dev, Error **errp)
          */
         memory_region_init_alias(cpu->cpu_as_mem, OBJECT(cpu), "memory",
                                  get_system_memory(), 0, ~0ull);
-        memory_region_add_subregion_overlap(cpu->cpu_as_root, 0, cpu->cpu_as_mem, 0);
+        memory_region_add_subregion(cpu->cpu_as_root, 0, cpu->cpu_as_mem);
         memory_region_set_enabled(cpu->cpu_as_mem, true);
 
         cs->num_ases = 2;
diff --git a/target/i386/kvm.c b/target/i386/kvm.c
index 1d10046a6c..4e1ba9d474 100644
--- a/target/i386/kvm.c
+++ b/target/i386/kvm.c
@@ -2081,7 +2081,7 @@  static void register_smram_listener(Notifier *n, void *unused)
      */
     memory_region_init_alias(&smram_as_mem, OBJECT(kvm_state), "mem-smram",
                              get_system_memory(), 0, ~0ull);
-    memory_region_add_subregion_overlap(&smram_as_root, 0, &smram_as_mem, 0);
+    memory_region_add_subregion(&smram_as_root, 0, &smram_as_mem);
     memory_region_set_enabled(&smram_as_mem, true);
 
     if (smram) {