]> xenbits.xensource.com Git - qemu-xen.git/commitdiff
target/xtensa/cpu: Set owner of memory region in xtensa_cpu_initfn
authorThomas Huth <thuth@redhat.com>
Thu, 19 Jul 2018 13:02:00 +0000 (15:02 +0200)
committerPeter Maydell <peter.maydell@linaro.org>
Mon, 6 Aug 2018 18:07:21 +0000 (19:07 +0100)
The instance_init function of the xtensa CPUs creates a memory region,
but does not set an owner, so the memory region is not destroyed
correctly when the CPU object is removed. This can happen when
introspecting the CPU devices, so introspecting the CPU device will
leave a dangling memory region object in the QOM tree. Make sure to
set the right owner here to fix this issue.

Signed-off-by: Thomas Huth <thuth@redhat.com>
Acked-by: Max Filippov <jcmvbkbc@gmail.com>
Message-id: 1532005320-17794-1-git-send-email-thuth@redhat.com
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
target/xtensa/cpu.c

index b50c840e09ec0411589d05c890a031620d8fb140..590813d4f7b9815f13c9a17eb0987c4de92d115b 100644 (file)
@@ -149,7 +149,7 @@ static void xtensa_cpu_initfn(Object *obj)
 #ifndef CONFIG_USER_ONLY
     env->address_space_er = g_malloc(sizeof(*env->address_space_er));
     env->system_er = g_malloc(sizeof(*env->system_er));
-    memory_region_init_io(env->system_er, NULL, NULL, env, "er",
+    memory_region_init_io(env->system_er, obj, NULL, env, "er",
                           UINT64_C(0x100000000));
     address_space_init(env->address_space_er, env->system_er, "ER");
 #endif