From: Lai Jiangshan Date: Tue, 20 Dec 2011 09:08:43 +0000 (+0800) Subject: kvm tools: cleanup kvm_cmd_balloon() X-Git-Tag: next-20120402~5^2~97 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=229ecfcc80c90b26e4dcd1adbe951a3e653b3215;p=karo-tx-linux.git kvm tools: cleanup kvm_cmd_balloon() Use stack variable. Remove unneeded branch. Close opened file. Signed-off-by: Lai Jiangshan Signed-off-by: Pekka Enberg --- diff --git a/tools/kvm/builtin-balloon.c b/tools/kvm/builtin-balloon.c index 5f1259e3c1e2..3f3056e55513 100644 --- a/tools/kvm/builtin-balloon.c +++ b/tools/kvm/builtin-balloon.c @@ -9,7 +9,6 @@ #include #include -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");