svn commit: r186250 - head/sys/dev/ata/chipsets
Alexander Motin
mav at FreeBSD.org
Wed Dec 17 19:17:59 UTC 2008
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;
}
More information about the svn-src-head
mailing list