aboutsummaryrefslogtreecommitdiff
path: root/hw/virtio
diff options
context:
space:
mode:
Diffstat (limited to 'hw/virtio')
-rw-r--r--hw/virtio/vhost.c8
-rw-r--r--hw/virtio/virtio.c12
2 files changed, 6 insertions, 14 deletions
diff --git a/hw/virtio/vhost.c b/hw/virtio/vhost.c
index f62cfaf38e..9e6023af36 100644
--- a/hw/virtio/vhost.c
+++ b/hw/virtio/vhost.c
@@ -295,9 +295,7 @@ static inline void vhost_dev_log_resize(struct vhost_dev* dev, uint64_t size)
if (dev->log_size) {
vhost_log_sync_range(dev, 0, dev->log_size * VHOST_LOG_CHUNK - 1);
}
- if (dev->log) {
- g_free(dev->log);
- }
+ g_free(dev->log);
dev->log = log;
dev->log_size = size;
}
@@ -601,9 +599,7 @@ static int vhost_migration_log(MemoryListener *listener, int enable)
if (r < 0) {
return r;
}
- if (dev->log) {
- g_free(dev->log);
- }
+ g_free(dev->log);
dev->log = NULL;
dev->log_size = 0;
} else {
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index a07ae8ad91..3b938c8783 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -1164,10 +1164,8 @@ EventNotifier *virtio_queue_get_host_notifier(VirtQueue *vq)
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name)
{
- if (vdev->bus_name) {
- g_free(vdev->bus_name);
- vdev->bus_name = NULL;
- }
+ g_free(vdev->bus_name);
+ vdev->bus_name = NULL;
if (bus_name) {
vdev->bus_name = g_strdup(bus_name);
@@ -1206,10 +1204,8 @@ static void virtio_device_unrealize(DeviceState *dev, Error **errp)
}
}
- if (vdev->bus_name) {
- g_free(vdev->bus_name);
- vdev->bus_name = NULL;
- }
+ g_free(vdev->bus_name);
+ vdev->bus_name = NULL;
}
static void virtio_device_class_init(ObjectClass *klass, void *data)