Make sure to free resources on failure correctly in a couple of places

in ste_attach().
This commit is contained in:
Bill Paul 1999-08-31 05:20:59 +00:00
parent ead4c37a5d
commit ca11eaac63
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=50684

View File

@ -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;
}