From 229ecfcc80c90b26e4dcd1adbe951a3e653b3215 Mon Sep 17 00:00:00 2001 From: Lai Jiangshan Date: Tue, 20 Dec 2011 17:08:43 +0800 Subject: [PATCH] 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 --- tools/kvm/builtin-balloon.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) 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"); -- 2.39.5