]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
hw/xen: Do not unparent in instance_finalize()
authorAkihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Wed, 24 Sep 2025 04:37:26 +0000 (13:37 +0900)
committerPaolo Bonzini <pbonzini@redhat.com>
Wed, 24 Sep 2025 07:23:20 +0000 (09:23 +0200)
Children are automatically unparented so manually unparenting is
unnecessary.

Worse, automatic unparenting happens before the instance_finalize()
callback of the parent gets called, so object_unparent() calls in
the callback will refer to objects that are already unparented, which
is semantically incorrect.

Signed-off-by: Akihiko Odaki <odaki@rsg.ci.i.u-tokyo.ac.jp>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
Link: https://lore.kernel.org/r/20250924-use-v4-7-07c6c598f53d@rsg.ci.i.u-tokyo.ac.jp
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
hw/xen/xen_pt_msi.c

index 09cca4eecb1c0b46a4187933d94cdbf61537381e..e9ba17317abafcbde55b4afccab62000faf31f51 100644 (file)
@@ -637,14 +637,5 @@ void xen_pt_msix_unmap(XenPCIPassthroughState *s)
 
 void xen_pt_msix_delete(XenPCIPassthroughState *s)
 {
-    XenPTMSIX *msix = s->msix;
-
-    if (!msix) {
-        return;
-    }
-
-    object_unparent(OBJECT(&msix->mmio));
-
-    g_free(s->msix);
-    s->msix = NULL;
+    g_clear_pointer(&s->msix, g_free);
 }