Date: Wed, 17 Dec 2008 19:17:59 +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: r186250 - head/sys/dev/ata/chipsets Message-ID: <200812171917.mBHJHxOj012987@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: mav Date: Wed Dec 17 19:17:58 2008 New Revision: 186250 URL: http://svn.freebsd.org/changeset/base/186250 Log: Improve error handling at ata_ahci_chipinit(). Submitted by: Andrey V. Elsukov Modified: head/sys/dev/ata/chipsets/ata-ahci.c Modified: head/sys/dev/ata/chipsets/ata-ahci.c ============================================================================== --- head/sys/dev/ata/chipsets/ata-ahci.c Wed Dec 17 19:12:30 2008 (r186249) +++ head/sys/dev/ata/chipsets/ata-ahci.c Wed Dec 17 19:17:58 2008 (r186250) @@ -94,6 +94,7 @@ int ata_ahci_chipinit(device_t dev) { struct ata_pci_controller *ctlr = device_get_softc(dev); + int error; u_int32_t version; /* if we have a memory BAR(5) we are likely on an AHCI part */ @@ -105,14 +106,19 @@ ata_ahci_chipinit(device_t dev) /* setup interrupt delivery if not done allready by a vendor driver */ if (!ctlr->r_irq) { - if (ata_setup_interrupt(dev, ata_generic_intr)) + if (ata_setup_interrupt(dev, ata_generic_intr)) { + bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); return ENXIO; + } } else device_printf(dev, "AHCI called from vendor specific driver\n"); /* reset controller */ - ata_ahci_ctlr_reset(dev); + if ((error = ata_ahci_ctlr_reset(dev)) != 0) { + bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); + return (error); + }; /* get the number of HW channels */ ctlr->channels = @@ -154,7 +160,6 @@ ata_ahci_ctlr_reset(device_t dev) ATA_OUTL(ctlr->r_res2, ATA_AHCI_GHC, ATA_AHCI_GHC_HR); DELAY(1000000); if (ATA_INL(ctlr->r_res2, ATA_AHCI_GHC) & ATA_AHCI_GHC_HR) { - bus_release_resource(dev, ctlr->r_type2, ctlr->r_rid2, ctlr->r_res2); device_printf(dev, "AHCI controller reset failure\n"); return ENXIO; }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200812171917.mBHJHxOj012987>