]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
kvm tools: cleanup kvm_cmd_balloon()
authorLai Jiangshan <laijs@cn.fujitsu.com>
Tue, 20 Dec 2011 09:08:43 +0000 (17:08 +0800)
committerPekka Enberg <penberg@kernel.org>
Wed, 21 Dec 2011 20:28:07 +0000 (22:28 +0200)
Use stack variable.
Remove unneeded branch.
Close opened file.

Signed-off-by: Lai Jiangshan <laijs@cn.fujitsu.com>
Signed-off-by: Pekka Enberg <penberg@kernel.org>
tools/kvm/builtin-balloon.c

index 5f1259e3c1e2cfe1952a72d9f5045dc0c4cbc631..3f3056e55513e76e9db26e08f1023baeb2baec35 100644 (file)
@@ -9,7 +9,6 @@
 #include <kvm/kvm.h>
 #include <kvm/kvm-ipc.h>
 
-static int instance;
 static const char *instance_name;
 static u64 inflate;
 static u64 deflate;
@@ -52,6 +51,7 @@ static void parse_balloon_options(int argc, const char **argv)
 int kvm_cmd_balloon(int argc, const char **argv, const char *prefix)
 {
        struct balloon_cmd cmd;
+       int instance;
        int r;
 
        parse_balloon_options(argc, argv);
@@ -59,12 +59,10 @@ int kvm_cmd_balloon(int argc, const char **argv, const char *prefix)
        if (inflate == 0 && deflate == 0)
                kvm_balloon_help();
 
-       if (instance_name == NULL &&
-           instance == 0)
+       if (instance_name == NULL)
                kvm_balloon_help();
 
-       if (instance_name)
-               instance = kvm__get_sock_by_instance(instance_name);
+       instance = kvm__get_sock_by_instance(instance_name);
 
        if (instance <= 0)
                die("Failed locating instance");