[tip:tools/kvm] kvm tools: virtio-rng init/exit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit-ID:  3b190952134bca2748b3902b57c646565107adcd
Gitweb:     http://git.kernel.org/tip/3b190952134bca2748b3902b57c646565107adcd
Author:     Sasha Levin <levinsasha928@xxxxxxxxx>
AuthorDate: Wed, 5 Sep 2012 10:31:52 +0200
Committer:  Pekka Enberg <penberg@xxxxxxxxxx>
CommitDate: Wed, 5 Sep 2012 16:22:37 +0300

kvm tools: virtio-rng init/exit

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@xxxxxxxxx>
Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx>
---
 tools/kvm/builtin-run.c |    7 +++++--
 tools/kvm/virtio/rng.c  |    3 +++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/tools/kvm/builtin-run.c b/tools/kvm/builtin-run.c
index c9a7f20..906d713 100644
--- a/tools/kvm/builtin-run.c
+++ b/tools/kvm/builtin-run.c
@@ -1130,8 +1130,11 @@ static int kvm_cmd_run_init(int argc, const char **argv)
 		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);
diff --git a/tools/kvm/virtio/rng.c b/tools/kvm/virtio/rng.c
index 2b1ab39..91228e2 100644
--- a/tools/kvm/virtio/rng.c
+++ b/tools/kvm/virtio/rng.c
@@ -147,6 +147,9 @@ int virtio_rng__init(struct kvm *kvm)
 	struct rng_dev *rdev;
 	int r;
 
+	if (!kvm->cfg.virtio_rng)
+		return 0;
+
 	rdev = malloc(sizeof(*rdev));
 	if (rdev == NULL)
 		return -ENOMEM;
--
To unsubscribe from this list: send the line "unsubscribe linux-tip-commits" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux Stable Commits]     [Linux Stable Kernel]     [Linux Kernel]     [Linux USB Devel]     [Linux Video &Media]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux