Make the init/exit of virtio-rng 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.virtio_rng)
- virtio_rng__init(kvm);
+ r = virtio_rng__init(kvm);
+ if (r < 0) {
+ pr_err("virtio_rng__init() failed with error %d\n", r);
+ goto fail;
+ }
if (kvm->cfg.balloon)
virtio_bln__init(kvm);
struct rng_dev *rdev;
int r;
+ if (!kvm->cfg.virtio_rng)
+ return 0;
+
rdev = malloc(sizeof(*rdev));
if (rdev == NULL)
return -ENOMEM;