summaryrefslogtreecommitdiffstats
path: root/sys
diff options
context:
space:
mode:
authorsos <sos@FreeBSD.org>2005-10-10 19:12:43 +0000
committersos <sos@FreeBSD.org>2005-10-10 19:12:43 +0000
commit2907b6fd67f942e457672855d0b9960e805b72b8 (patch)
tree0dc125e82684a2a171933975edd6e797f7f2d807 /sys
parentde284e519217b9ec708fac763bf10d919eb4ce5a (diff)
downloadFreeBSD-src-2907b6fd67f942e457672855d0b9960e805b72b8.zip
FreeBSD-src-2907b6fd67f942e457672855d0b9960e805b72b8.tar.gz
Properly react to allocation failures.
Found by: imp@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/ata/ata-chipset.c17
1 files changed, 11 insertions, 6 deletions
diff --git a/sys/dev/ata/ata-chipset.c b/sys/dev/ata/ata-chipset.c
index 62817f3..a5af06e 100644
--- a/sys/dev/ata/ata-chipset.c
+++ b/sys/dev/ata/ata-chipset.c
@@ -915,8 +915,10 @@ ata_ali_allocate(device_t dev)
struct ata_channel *ch = device_get_softc(dev);
/* setup the usual register normal pci style */
- ata_pci_allocate(dev);
+ if (ata_pci_allocate(dev))
+ return ENXIO;
+ /* older chips can't do 48bit DMA transfers */
if (ctlr->chip->chiprev <= 0xc4)
ch->flags |= ATA_NO_48BIT_DMA;
@@ -2137,7 +2139,8 @@ ata_nvidia_allocate(device_t dev)
struct ata_channel *ch = device_get_softc(dev);
/* setup the usual register normal pci style */
- ata_pci_allocate(dev);
+ if (ata_pci_allocate(dev))
+ return ENXIO;
ch->r_io[ATA_SSTATUS].res = ctlr->r_res2;
ch->r_io[ATA_SSTATUS].offset = (ch->unit << 6);
@@ -3819,7 +3822,8 @@ ata_sis_allocate(device_t dev)
struct ata_channel *ch = device_get_softc(dev);
/* setup the usual register normal pci style */
- ata_pci_allocate(dev);
+ if (ata_pci_allocate(dev))
+ return ENXIO;
ch->r_io[ATA_SSTATUS].res = ctlr->r_res2;
ch->r_io[ATA_SSTATUS].offset = (ch->unit << 4);
@@ -4024,7 +4028,6 @@ ata_via_allocate(device_t dev)
struct ata_pci_controller *ctlr = device_get_softc(device_get_parent(dev));
struct ata_channel *ch = device_get_softc(dev);
-
/* newer SATA chips has resources in one BAR for each channel */
if (ctlr->chip->cfg2 & VIABAR) {
struct resource *r_io;
@@ -4050,8 +4053,10 @@ ata_via_allocate(device_t dev)
}
ata_generic_hw(dev);
}
- else
- ata_pci_allocate(dev);
+ else {
+ if (ata_pci_allocate(dev))
+ return ENXIO;
+ }
ch->r_io[ATA_SSTATUS].res = ctlr->r_res2;
ch->r_io[ATA_SSTATUS].offset = (ch->unit << ctlr->chip->cfg1);
OpenPOWER on IntegriCloud