From owner-svn-src-all@FreeBSD.ORG Tue Jul 20 05:14:31 2010 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 3487D1065679; Tue, 20 Jul 2010 05:14:31 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 1F4D48FC1D; Tue, 20 Jul 2010 05:14:31 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id o6K5EVEL094751; Tue, 20 Jul 2010 05:14:31 GMT (envelope-from mav@svn.freebsd.org) Received: (from mav@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id o6K5EVE8094749; Tue, 20 Jul 2010 05:14:31 GMT (envelope-from mav@svn.freebsd.org) Message-Id: <201007200514.o6K5EVE8094749@svn.freebsd.org> From: Alexander Motin Date: Tue, 20 Jul 2010 05:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org X-SVN-Group: stable-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r210280 - stable/8/sys/dev/ata X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 20 Jul 2010 05:14:31 -0000 Author: mav Date: Tue Jul 20 05:14:30 2010 New Revision: 210280 URL: http://svn.freebsd.org/changeset/base/210280 Log: MFC r210165: Improve interrupt setup errors handling. Modified: stable/8/sys/dev/ata/ata-pci.c Directory Properties: stable/8/sys/ (props changed) stable/8/sys/amd64/include/xen/ (props changed) stable/8/sys/cddl/contrib/opensolaris/ (props changed) stable/8/sys/contrib/dev/acpica/ (props changed) stable/8/sys/contrib/pf/ (props changed) stable/8/sys/dev/xen/xenpci/ (props changed) Modified: stable/8/sys/dev/ata/ata-pci.c ============================================================================== --- stable/8/sys/dev/ata/ata-pci.c Tue Jul 20 05:14:27 2010 (r210279) +++ stable/8/sys/dev/ata/ata-pci.c Tue Jul 20 05:14:30 2010 (r210280) @@ -806,17 +806,23 @@ ata_setup_interrupt(device_t dev, void * if (msi && pci_msi_count(dev) > 0 && pci_alloc_msi(dev, &msi) == 0) { ctlr->r_irq_rid = 0x1; } else { + msi = 0; ctlr->r_irq_rid = ATA_IRQ_RID; } if (!(ctlr->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ, &ctlr->r_irq_rid, RF_SHAREABLE | RF_ACTIVE))) { device_printf(dev, "unable to map interrupt\n"); + if (msi) + pci_release_msi(dev); return ENXIO; } if ((bus_setup_intr(dev, ctlr->r_irq, ATA_INTR_FLAGS, NULL, intr_func, ctlr, &ctlr->handle))) { - /* SOS XXX release r_irq */ device_printf(dev, "unable to setup interrupt\n"); + bus_release_resource(dev, + SYS_RES_IRQ, ctlr->r_irq_rid, ctlr->r_irq); + if (msi) + pci_release_msi(dev); return ENXIO; } }