From: Sepherosa Ziehau Date: Wed, 8 Aug 2012 05:21:20 +0000 (+0800) Subject: em/emx: Fix up detach path X-Git-Tag: v3.2.0~448 X-Git-Url: http://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/a19a8754e8504e3a7ae33e24c4f9099aaa84c62e em/emx: Fix up detach path - We could release management control only if PCI BAR is mapped - Release multicase array memory --- diff --git a/sys/dev/netif/em/if_em.c b/sys/dev/netif/em/if_em.c index e3b959d..0e55bb7 100644 --- a/sys/dev/netif/em/if_em.c +++ b/sys/dev/netif/em/if_em.c @@ -870,7 +870,7 @@ em_detach(device_t dev) lwkt_serialize_exit(ifp->if_serializer); ether_ifdetach(ifp); - } else { + } else if (adapter->memory != NULL) { em_rel_hw_control(adapter); } bus_generic_detach(dev); @@ -896,6 +896,9 @@ em_detach(device_t dev) if (adapter->sysctl_tree != NULL) sysctl_ctx_free(&adapter->sysctl_ctx); + if (adapter->mta != NULL) + kfree(adapter->mta, M_DEVBUF); + return (0); } diff --git a/sys/dev/netif/emx/if_emx.c b/sys/dev/netif/emx/if_emx.c index b8526ea..50cf712 100644 --- a/sys/dev/netif/emx/if_emx.c +++ b/sys/dev/netif/emx/if_emx.c @@ -788,7 +788,7 @@ emx_detach(device_t dev) ifnet_deserialize_all(ifp); ether_ifdetach(ifp); - } else { + } else if (sc->memory != NULL) { emx_rel_hw_control(sc); } bus_generic_detach(dev); @@ -812,6 +812,9 @@ emx_detach(device_t dev) if (sc->sysctl_tree != NULL) sysctl_ctx_free(&sc->sysctl_ctx); + if (sc->mta != NULL) + kfree(sc->mta, M_DEVBUF); + return (0); }