Commit-ID: 229ecfcc80c90b26e4dcd1adbe951a3e653b3215 Gitweb: http://git.kernel.org/tip/229ecfcc80c90b26e4dcd1adbe951a3e653b3215 Author: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> AuthorDate: Tue, 20 Dec 2011 17:08:43 +0800 Committer: Pekka Enberg <penberg@xxxxxxxxxx> CommitDate: Wed, 21 Dec 2011 22:28:07 +0200 kvm tools: cleanup kvm_cmd_balloon() Use stack variable. Remove unneeded branch. Close opened file. Signed-off-by: Lai Jiangshan <laijs@xxxxxxxxxxxxxx> Signed-off-by: Pekka Enberg <penberg@xxxxxxxxxx> --- tools/kvm/builtin-balloon.c | 8 +++----- 1 files changed, 3 insertions(+), 5 deletions(-) diff --git a/tools/kvm/builtin-balloon.c b/tools/kvm/builtin-balloon.c index 5f1259e..3f3056e 100644 --- a/tools/kvm/builtin-balloon.c +++ b/tools/kvm/builtin-balloon.c @@ -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"); -- 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