aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio/virtio.c
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio/virtio.c')
-rw-r--r--hw/virtio/virtio.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 1dba284e4a..144b9ca2ef 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1169,12 +1169,15 @@ static void virtio_device_realize(DeviceState *dev, Error **errp)
static void virtio_device_unrealize(DeviceState *dev, Error **errp)
{
VirtIODevice *vdev = VIRTIO_DEVICE(dev);
- VirtioDeviceClass *k = VIRTIO_DEVICE_GET_CLASS(dev);
-
- virtio_bus_device_unplugged(vdev);
+ VirtioDeviceClass *vdc = VIRTIO_DEVICE_GET_CLASS(dev);
+ Error *err = NULL;
- if (k->exit != NULL) {
- k->exit(vdev);
+ if (vdc->unrealize != NULL) {
+ vdc->unrealize(dev, &err);
+ if (err != NULL) {
+ error_propagate(errp, err);
+ return;
+ }
}
if (vdev->bus_name) {