Make the init/exit of virtio-balloon self-contained, so the global init code
won't need to check if it was selected or not.
Signed-off-by: Sasha Levin <levinsasha928@gmail.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
goto fail;
}
- if (kvm->cfg.balloon)
- virtio_bln__init(kvm);
+ r = virtio_bln__init(kvm);
+ if (r < 0) {
+ pr_err("virtio_rng__init() failed with error %d\n", r);
+ goto fail;
+ }
if (!kvm->cfg.network)
kvm->cfg.network = DEFAULT_NETWORK;
if (r < 0)
pr_warning("virtio_rng__exit() failed with error %d\n", r);
+ r = virtio_bln__exit(kvm);
+ if (r < 0)
+ pr_warning("virtio_bln__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);
struct kvm;
-void virtio_bln__init(struct kvm *kvm);
+int virtio_bln__init(struct kvm *kvm);
+int virtio_bln__exit(struct kvm *kvm);
#endif /* KVM__BLN_VIRTIO_H */
.get_size_vq = get_size_vq,
};
-void virtio_bln__init(struct kvm *kvm)
+int virtio_bln__init(struct kvm *kvm)
{
+ if (!kvm->cfg.balloon)
+ return 0;
+
kvm_ipc__register_handler(KVM_IPC_BALLOON, handle_mem);
kvm_ipc__register_handler(KVM_IPC_STAT, virtio_bln__print_stats);
if (compat_id == -1)
compat_id = virtio_compat_add_message("virtio-balloon", "CONFIG_VIRTIO_BALLOON");
+
+ return 0;
+}
+
+int virtio_bln__exit(struct kvm *kvm)
+{
+ return 0;
}