From patchwork Tue Feb 9 01:18:03 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 77909 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter.kernel.org (8.14.3/8.14.3) with ESMTP id o191GtSk029279 for ; Tue, 9 Feb 2010 01:16:55 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752029Ab0BIBQw (ORCPT ); Mon, 8 Feb 2010 20:16:52 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:60995 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1751763Ab0BIBQw (ORCPT ); Mon, 8 Feb 2010 20:16:52 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id BFF45170044; Tue, 9 Feb 2010 09:16:50 +0800 (CST) Received: from fnst.cn.fujitsu.com (tang.cn.fujitsu.com [127.0.0.1]) by tang.cn.fujitsu.com (8.14.3/8.13.1) with ESMTP id o191G63K003974; Tue, 9 Feb 2010 09:16:06 +0800 Received: from [10.167.141.76] (unknown [10.167.141.76]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 11DA1D47CB; Tue, 9 Feb 2010 09:18:21 +0800 (CST) Message-ID: <4B70B7CB.8070209@cn.fujitsu.com> Date: Tue, 09 Feb 2010 09:18:03 +0800 From: Wei Yongjun User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: Marcelo Tosatti CC: kvm@vger.kernel.org Subject: [PATCHv2] KVM: kvm->arch.vioapic should be NULL if kvm_ioapic_init() failure References: <4B6FD2DB.9040104@cn.fujitsu.com> <4B6FD377.205@cn.fujitsu.com> <4B6FDB2D.9080707@cn.fujitsu.com> <20100208180754.GC5415@amt.cnet> In-Reply-To: <20100208180754.GC5415@amt.cnet> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.3 (demeter.kernel.org [140.211.167.41]); Tue, 09 Feb 2010 01:16:56 +0000 (UTC) diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index a2edfd1..f3d0693 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -393,8 +393,10 @@ int kvm_ioapic_init(struct kvm *kvm) mutex_lock(&kvm->slots_lock); ret = kvm_io_bus_register_dev(kvm, KVM_MMIO_BUS, &ioapic->dev); mutex_unlock(&kvm->slots_lock); - if (ret < 0) + if (ret < 0) { + kvm->arch.vioapic = NULL; kfree(ioapic); + } return ret; }