From patchwork Mon May 2 09:13:57 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kiszka X-Patchwork-Id: 93612 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [140.186.70.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 990CAB6F0A for ; Mon, 2 May 2011 19:14:26 +1000 (EST) Received: from localhost ([::1]:37370 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpCw-0007Vu-NJ for incoming@patchwork.ozlabs.org; Mon, 02 May 2011 05:14:22 -0400 Received: from eggs.gnu.org ([140.186.70.92]:36050) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpCc-0007Bq-UO for qemu-devel@nongnu.org; Mon, 02 May 2011 05:14:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QGpCb-0005lD-W2 for qemu-devel@nongnu.org; Mon, 02 May 2011 05:14:02 -0400 Received: from thoth.sbs.de ([192.35.17.2]:20292) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QGpCb-0005l4-N8 for qemu-devel@nongnu.org; Mon, 02 May 2011 05:14:01 -0400 Received: from mail1.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id p429DwUo019144; Mon, 2 May 2011 11:13:58 +0200 Received: from mchn199C.mchp.siemens.de ([139.25.109.49]) by mail1.siemens.de (8.13.6/8.13.6) with ESMTP id p429DvxD007079; Mon, 2 May 2011 11:13:57 +0200 Message-ID: <4DBE75D5.8050901@siemens.com> Date: Mon, 02 May 2011 11:13:57 +0200 From: Jan Kiszka User-Agent: Mozilla/5.0 (X11; U; Linux i686 (x86_64); de; rv:1.8.1.12) Gecko/20080226 SUSE/2.0.0.12-1.1 Thunderbird/2.0.0.12 Mnenhy/0.7.5.666 MIME-Version: 1.0 To: qemu-devel X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6, seldom 2.4 (older, 4) X-Received-From: 192.35.17.2 Cc: Alexander Graf , Gerd Hoffmann Subject: [Qemu-devel] [PATCH] MSI: Fix release of resources X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org msi_init may fail, so the users should check msi_present before calling msi_uninit. Signed-off-by: Jan Kiszka --- hw/ide/ich.c | 2 +- hw/intel-hda.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/ide/ich.c b/hw/ide/ich.c index a3d475c..35e1de7 100644 --- a/hw/ide/ich.c +++ b/hw/ide/ich.c @@ -110,7 +110,7 @@ static int pci_ich9_uninit(PCIDevice *dev) struct AHCIPCIState *d; d = DO_UPCAST(struct AHCIPCIState, card, dev); - if (msi_enabled(dev)) { + if (msi_present(dev)) { msi_uninit(dev); } diff --git a/hw/intel-hda.c b/hw/intel-hda.c index b0b1d12..ff99348 100644 --- a/hw/intel-hda.c +++ b/hw/intel-hda.c @@ -1174,7 +1174,7 @@ static int intel_hda_exit(PCIDevice *pci) { IntelHDAState *d = DO_UPCAST(IntelHDAState, pci, pci); - if (d->msi) { + if (msi_present(pci)) { msi_uninit(&d->pci); } cpu_unregister_io_memory(d->mmio_addr);