From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yang Bai Subject: [PATCH 1/4] kvm tool: Stop init if check_extensions failed Date: Fri, 10 Feb 2012 17:55:33 +0800 Message-ID: <1328867736-4394-1-git-send-email-hamo.by@gmail.com> Cc: kvm@vger.kernel.org, Yang Bai To: penberg@kernel.org Return-path: Received: from mail-pw0-f46.google.com ([209.85.160.46]:44470 "EHLO mail-pw0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754079Ab2BJJ4z (ORCPT ); Fri, 10 Feb 2012 04:56:55 -0500 Received: by pbcun15 with SMTP id un15so2294311pbc.19 for ; Fri, 10 Feb 2012 01:56:55 -0800 (PST) Sender: kvm-owner@vger.kernel.org List-ID: If kvm__check_extensions found that some of the required KVM extention is not supported by OS, we should stop the init and free all allocated resources. Signed-off-by: Yang Bai --- tools/kvm/kvm.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/tools/kvm/kvm.c b/tools/kvm/kvm.c index 9a0bd67..8e749ad 100644 --- a/tools/kvm/kvm.c +++ b/tools/kvm/kvm.c @@ -384,6 +384,7 @@ struct kvm *kvm__init(const char *kvm_dev, const char *hugetlbfs_path, u64 ram_s if (kvm__check_extensions(kvm)) { pr_err("A required KVM extention is not supported by OS"); ret = -ENOSYS; + goto err; } kvm__arch_init(kvm, hugetlbfs_path, ram_size); -- 1.7.8.3