aboutsummaryrefslogtreecommitdiff
path: root/hw/xen
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2017-02-03 12:31:40 +0000
committerPeter Maydell <peter.maydell@linaro.org>2017-02-03 12:31:40 +0000
commit4100a344eb3d50d88f9da85cae334afc47aee134 (patch)
tree42156e1fd553310e3735f16f92e3d3930bce677b /hw/xen
parent77e217d1bf63c4d042c17f7d55b0816a7d386bf3 (diff)
parente9dcbc86d614018923e26e31319b0a54c9e5abac (diff)
downloadqemu-4100a344eb3d50d88f9da85cae334afc47aee134.zip
qemu-4100a344eb3d50d88f9da85cae334afc47aee134.tar.gz
qemu-4100a344eb3d50d88f9da85cae334afc47aee134.tar.bz2
Merge remote-tracking branch 'remotes/sstabellini/tags/xen-20170202' into staging
Xen 2017/02/02 # gpg: Signature made Thu 02 Feb 2017 18:26:58 GMT # gpg: using RSA key 0x894F8F4870E1AE90 # gpg: Good signature from "Stefano Stabellini <sstabellini@kernel.org>" # gpg: aka "Stefano Stabellini <stefano.stabellini@eu.citrix.com>" # Primary key fingerprint: D04E 33AB A51F 67BA 07D3 0AEA 894F 8F48 70E1 AE90 * remotes/sstabellini/tags/xen-20170202: xen: use qdev_unplug() instead of g_free() in xen_pv_find_xendev() MAINTAINERS: Update xen-devel mailing list address xen-platform: add missing disk unplug option xen-platform: add support for unplugging NVMe disks... xen-platform: re-structure unplug_disks Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Diffstat (limited to 'hw/xen')
-rw-r--r--hw/xen/xen_backend.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/hw/xen/xen_backend.c b/hw/xen/xen_backend.c
index d119004..6c21c37 100644
--- a/hw/xen/xen_backend.c
+++ b/hw/xen/xen_backend.c
@@ -124,10 +124,11 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
/* init new xendev */
xendev = g_malloc0(ops->size);
object_initialize(&xendev->qdev, ops->size, TYPE_XENBACKEND);
- qdev_set_parent_bus(&xendev->qdev, xen_sysbus);
- qdev_set_id(&xendev->qdev, g_strdup_printf("xen-%s-%d", type, dev));
- qdev_init_nofail(&xendev->qdev);
- object_unref(OBJECT(&xendev->qdev));
+ OBJECT(xendev)->free = g_free;
+ qdev_set_parent_bus(DEVICE(xendev), xen_sysbus);
+ qdev_set_id(DEVICE(xendev), g_strdup_printf("xen-%s-%d", type, dev));
+ qdev_init_nofail(DEVICE(xendev));
+ object_unref(OBJECT(xendev));
xendev->type = type;
xendev->dom = dom;
@@ -145,7 +146,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
xendev->evtchndev = xenevtchn_open(NULL, 0);
if (xendev->evtchndev == NULL) {
xen_pv_printf(NULL, 0, "can't open evtchn device\n");
- g_free(xendev);
+ qdev_unplug(DEVICE(xendev), NULL);
return NULL;
}
fcntl(xenevtchn_fd(xendev->evtchndev), F_SETFD, FD_CLOEXEC);
@@ -155,7 +156,7 @@ static struct XenDevice *xen_be_get_xendev(const char *type, int dom, int dev,
if (xendev->gnttabdev == NULL) {
xen_pv_printf(NULL, 0, "can't open gnttab device\n");
xenevtchn_close(xendev->evtchndev);
- g_free(xendev);
+ qdev_unplug(DEVICE(xendev), NULL);
return NULL;
}
} else {