summaryrefslogtreecommitdiffstats
path: root/sys/pci/if_ste.c
diff options
context:
space:
mode:
authorwpaul <wpaul@FreeBSD.org>1999-08-31 05:20:59 +0000
committerwpaul <wpaul@FreeBSD.org>1999-08-31 05:20:59 +0000
commitae3a819c799c2cb57d7ea851361cc8afcfef8d65 (patch)
tree98cea6959e07e7ac65d539813c969df49034a1a8 /sys/pci/if_ste.c
parent435fdb9a3c48dd48ec4c27a7f30a64a23c60c818 (diff)
downloadFreeBSD-src-ae3a819c799c2cb57d7ea851361cc8afcfef8d65.zip
FreeBSD-src-ae3a819c799c2cb57d7ea851361cc8afcfef8d65.tar.gz
Make sure to free resources on failure correctly in a couple of places
in ste_attach().
Diffstat (limited to 'sys/pci/if_ste.c')
-rw-r--r--sys/pci/if_ste.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/sys/pci/if_ste.c b/sys/pci/if_ste.c
index d3fb8b3..eac1a18 100644
--- a/sys/pci/if_ste.c
+++ b/sys/pci/if_ste.c
@@ -1043,7 +1043,10 @@ static int ste_attach(dev)
if (ste_read_eeprom(sc, (caddr_t)&sc->arpcom.ac_enaddr,
STE_EEADDR_NODE0, 3, 0)) {
printf("ste%d: failed to read station address\n", unit);
- free(sc, M_DEVBUF);
+ bus_teardown_intr(dev, sc->ste_irq, sc->ste_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ste_irq);
+ bus_release_resource(dev, STE_RES, STE_RID, sc->ste_res);
+ error = ENXIO;;
goto fail;
}
@@ -1060,8 +1063,11 @@ static int ste_attach(dev)
M_NOWAIT, 0, 0xffffffff, PAGE_SIZE, 0);
if (sc->ste_ldata == NULL) {
- free(sc, M_DEVBUF);
printf("ste%d: no memory for list buffers!\n", unit);
+ bus_teardown_intr(dev, sc->ste_irq, sc->ste_intrhand);
+ bus_release_resource(dev, SYS_RES_IRQ, 0, sc->ste_irq);
+ bus_release_resource(dev, STE_RES, STE_RID, sc->ste_res);
+ error = ENXIO;
goto fail;
}
OpenPOWER on IntegriCloud