svn commit: r211456 - stable/8/sys/dev/ahci
Alexander Motin
mav at FreeBSD.org
Wed Aug 18 15:49:45 UTC 2010
Author: mav
Date: Wed Aug 18 15:49:44 2010
New Revision: 211456
URL: http://svn.freebsd.org/changeset/base/211456
Log:
MFC r208813:
Fix attach errors handling.
Found with: Coverity Prevent(tm)
CID: 3424
Modified:
stable/8/sys/dev/ahci/ahci.c
Directory Properties:
stable/8/sys/ (props changed)
stable/8/sys/amd64/include/xen/ (props changed)
stable/8/sys/cam/ (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/ahci/ahci.c
==============================================================================
--- stable/8/sys/dev/ahci/ahci.c Wed Aug 18 15:38:10 2010 (r211455)
+++ stable/8/sys/dev/ahci/ahci.c Wed Aug 18 15:49:44 2010 (r211456)
@@ -892,9 +892,9 @@ ahci_ch_attach(device_t dev)
rid = ATA_IRQ_RID;
if (!(ch->r_irq = bus_alloc_resource_any(dev, SYS_RES_IRQ,
&rid, RF_SHAREABLE | RF_ACTIVE))) {
- bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem);
device_printf(dev, "Unable to map interrupt\n");
- return (ENXIO);
+ error = ENXIO;
+ goto err0;
}
if ((bus_setup_intr(dev, ch->r_irq, ATA_INTR_FLAGS, NULL,
ahci_ch_intr_locked, dev, &ch->ih))) {
@@ -928,9 +928,10 @@ ahci_ch_attach(device_t dev)
(ch->caps & AHCI_CAP_SNCQ) ? ch->numslots : 0,
devq);
if (ch->sim == NULL) {
+ cam_simq_free(devq);
device_printf(dev, "unable to allocate sim\n");
error = ENOMEM;
- goto err2;
+ goto err1;
}
if (xpt_bus_register(ch->sim, dev, 0) != CAM_SUCCESS) {
device_printf(dev, "unable to register xpt bus\n");
@@ -957,6 +958,7 @@ err2:
cam_sim_free(ch->sim, /*free_devq*/TRUE);
err1:
bus_release_resource(dev, SYS_RES_IRQ, ATA_IRQ_RID, ch->r_irq);
+err0:
bus_release_resource(dev, SYS_RES_MEMORY, ch->unit, ch->r_mem);
mtx_unlock(&ch->mtx);
return (error);
More information about the svn-src-stable-8
mailing list