Fix another edge case I just noticed when committing the previous changes:

If bus_setup_intr() fails, cleanup the ifnet setup in vx_attach() by
calling ether_ifdetach() and if_free().

MFC after:	1 week
This commit is contained in:
John Baldwin 2005-10-06 18:41:31 +00:00
parent fa08ebbbb1
commit 46ceae8bc4
2 changed files with 6 additions and 0 deletions

View File

@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$");
#include <machine/resource.h>
#include <sys/rman.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
@ -159,6 +160,8 @@ vx_eisa_attach(device_t dev)
bad_mtx:
mtx_destroy(&sc->vx_mtx);
ether_ifdetach(sc->vx_ifp);
if_free(sc->vx_ifp);
bad:
if (io)
bus_release_resource(dev, SYS_RES_IOPORT, 0, io);

View File

@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$");
#include <sys/module.h>
#include <sys/socket.h>
#include <net/ethernet.h>
#include <net/if.h>
#include <net/if_arp.h>
@ -167,6 +168,8 @@ vx_pci_attach(device_t dev)
bad_mtx:
mtx_destroy(&sc->vx_mtx);
ether_ifdetach(sc->vx_ifp);
if_free(sc->vx_ifp);
bad:
if (sc->vx_intrhand != NULL)
bus_teardown_intr(dev, sc->vx_irq, sc->vx_intrhand);