Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 16 Jul 2010 10:05:00 +0000 (UTC)
From:      Alexander Motin <mav@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r210165 - head/sys/dev/ata
Message-ID:  <201007161005.o6GA50vl074303@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mav
Date: Fri Jul 16 10:05:00 2010
New Revision: 210165
URL: http://svn.freebsd.org/changeset/base/210165

Log:
  Improve interrupt setup errors handling.

Modified:
  head/sys/dev/ata/ata-pci.c

Modified: head/sys/dev/ata/ata-pci.c
==============================================================================
--- head/sys/dev/ata/ata-pci.c	Fri Jul 16 09:12:47 2010	(r210164)
+++ head/sys/dev/ata/ata-pci.c	Fri Jul 16 10:05:00 2010	(r210165)
@@ -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?201007161005.o6GA50vl074303>