From patchwork Mon Feb 8 09:36:45 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wei Yongjun X-Patchwork-Id: 77688 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 o189Zheh001945 for ; Mon, 8 Feb 2010 09:35:44 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754371Ab0BHJfi (ORCPT ); Mon, 8 Feb 2010 04:35:38 -0500 Received: from cn.fujitsu.com ([222.73.24.84]:49357 "EHLO song.cn.fujitsu.com" rhost-flags-OK-FAIL-OK-OK) by vger.kernel.org with ESMTP id S1752966Ab0BHJfi (ORCPT ); Mon, 8 Feb 2010 04:35:38 -0500 Received: from tang.cn.fujitsu.com (tang.cn.fujitsu.com [10.167.250.3]) by song.cn.fujitsu.com (Postfix) with ESMTP id 501B5170028; Mon, 8 Feb 2010 17:35:37 +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 o189YriB025378; Mon, 8 Feb 2010 17:34:53 +0800 Received: from [10.167.141.76] (unknown [10.167.141.76]) by fnst.cn.fujitsu.com (Postfix) with ESMTPA id 9460AD47CB; Mon, 8 Feb 2010 17:37:06 +0800 (CST) Message-ID: <4B6FDB2D.9080707@cn.fujitsu.com> Date: Mon, 08 Feb 2010 17:36:45 +0800 From: Wei Yongjun User-Agent: Thunderbird 2.0.0.23 (X11/20090817) MIME-Version: 1.0 To: kvm@vger.kernel.org CC: Marcelo Tosatti Subject: [PATCH] KVM: only set kvm->arch.vioapic when success to init ioapic References: <4B6FD2DB.9040104@cn.fujitsu.com> <4B6FD377.205@cn.fujitsu.com> In-Reply-To: <4B6FD377.205@cn.fujitsu.com> 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]); Mon, 08 Feb 2010 09:35:44 +0000 (UTC) diff --git a/virt/kvm/ioapic.c b/virt/kvm/ioapic.c index a2edfd1..e13f529 100644 --- a/virt/kvm/ioapic.c +++ b/virt/kvm/ioapic.c @@ -386,7 +386,6 @@ int kvm_ioapic_init(struct kvm *kvm) if (!ioapic) return -ENOMEM; mutex_init(&ioapic->lock); - kvm->arch.vioapic = ioapic; kvm_ioapic_reset(ioapic); kvm_iodevice_init(&ioapic->dev, &ioapic_mmio_ops); ioapic->kvm = kvm; @@ -395,6 +394,8 @@ int kvm_ioapic_init(struct kvm *kvm) mutex_unlock(&kvm->slots_lock); if (ret < 0) kfree(ioapic); + else + kvm->arch.vioapic = ioapic; return ret; }