Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 20 Jul 2010 05:14:31 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r210280 - stable/8/sys/dev/ata
Message-ID:  <201007200514.o6K5EVE8094749@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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;
 	}
     }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201007200514.o6K5EVE8094749>