From 46ceae8bc4cd3ee267a5c0a25e5bd381a262fa89 Mon Sep 17 00:00:00 2001 From: John Baldwin Date: Thu, 6 Oct 2005 18:41:31 +0000 Subject: [PATCH] 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 --- sys/dev/vx/if_vx_eisa.c | 3 +++ sys/dev/vx/if_vx_pci.c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/sys/dev/vx/if_vx_eisa.c b/sys/dev/vx/if_vx_eisa.c index ec67e26f8390..459e34841342 100644 --- a/sys/dev/vx/if_vx_eisa.c +++ b/sys/dev/vx/if_vx_eisa.c @@ -42,6 +42,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -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); diff --git a/sys/dev/vx/if_vx_pci.c b/sys/dev/vx/if_vx_pci.c index 2e358d5436f3..dc0fea7a578c 100644 --- a/sys/dev/vx/if_vx_pci.c +++ b/sys/dev/vx/if_vx_pci.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include @@ -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);