goto fail;
}
-
- if (kvm->cfg.active_console == CONSOLE_VIRTIO)
- virtio_console__init(kvm);
+ r = virtio_console__init(kvm);
+ if (r < 0) {
+ pr_err("virtio_console__init() failed with error %d\n", r);
+ goto fail;
+ }
if (kvm->cfg.virtio_rng)
virtio_rng__init(kvm);
if (r < 0)
pr_warning("virtio_rng__exit() failed with error %d\n", r);
+ r = virtio_console__exit(kvm);
+ if (r < 0)
+ pr_warning("virtio_console__exit() failed with error %d\n", r);
+
r = disk_image__exit(kvm);
if (r < 0)
pr_warning("disk_image__exit() failed with error %d\n", r);
struct kvm;
-void virtio_console__init(struct kvm *kvm);
+int virtio_console__init(struct kvm *kvm);
void virtio_console__inject_interrupt(struct kvm *kvm);
+int virtio_console__exit(struct kvm *kvm);
#endif /* KVM__CONSOLE_VIRTIO_H */
.get_size_vq = get_size_vq,
};
-void virtio_console__init(struct kvm *kvm)
+int virtio_console__init(struct kvm *kvm)
{
+ if (kvm->cfg.active_console != CONSOLE_VIRTIO)
+ return 0;
+
virtio_init(kvm, &cdev, &cdev.vdev, &con_dev_virtio_ops,
VIRTIO_PCI, PCI_DEVICE_ID_VIRTIO_CONSOLE, VIRTIO_ID_CONSOLE, PCI_CLASS_CONSOLE);
if (compat_id == -1)
compat_id = virtio_compat_add_message("virtio-console", "CONFIG_VIRTIO_CONSOLE");
+
+ return 0;
+}
+
+int virtio_console__exit(struct kvm *kvm)
+{
+ return 0;
}